Просмотр исходного кода

Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/gt_client_pad into develop

ZhaoJun 1 год назад
Родитель
Сommit
41f5509cf4

+ 8 - 2
.umirc.ts

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

+ 16 - 0
src/pages/DeviceManager/detail.less

@@ -0,0 +1,16 @@
+.detailBox {
+  display: flex;
+  flex-wrap: wrap;
+  span {
+    width: 50%;
+    line-height: 1.8;
+    font-size: 0.3rem;
+    display: flex;
+  }
+  label {
+    display: block;
+    width: 2.5rem;
+    text-align: right;
+    padding-right: 0.4rem;
+  }
+}

+ 93 - 75
src/pages/DeviceManager/deviceMaintainDetail.js

@@ -1,44 +1,60 @@
 import PageContent from '@/components/PageContent';
-import { useParams } from '@umijs/max';
 import { Table } from 'antd';
-export default function DeviceMaintainDetail() {
-  const { projectId, type } = useParams();
+import dayjs from 'dayjs';
+import ReactZmage from 'react-zmage';
+import styles from './detail.less';
+
+const {
+  DeviceCode,
+  DeviceName,
+  MaintainTime,
+  EvaluationScore,
+  Operators,
+  RustRemoval,
+  AntiCorrosive,
+  MaterialConsumption,
+  Fasten,
+  Clean,
+  Lubrication,
+  Check,
+  Note,
+  Files = [],
+} = JSON.parse(localStorage.maintain || '{}');
 
+export default function DeviceMaintainDetail() {
   const columns = [
     {
-      title: type == 1 ? '维修资料' : '保养资料',
+      title: '保养资料',
       dataIndex: 'Name',
       render: (text, item) => {
-        return <PreviewFile name={item.Name} src={item.Url} />;
+        return (
+          <ReactZmage
+            controller={{
+              // 关闭按钮
+              close: true,
+              // 缩放按钮
+              zoom: false,
+              // 下载按钮
+              download: false,
+              // 翻页按钮
+              flip: false,
+              // 多页指示
+              pagination: false,
+            }}
+            backdrop="rgba(255,255,255,0.5)"
+            style={{ width: '3.5rem' }}
+            src={item.Url}
+          />
+        );
       },
     },
     {
       title: '创建时间',
       dataIndex: 'CreatedTime',
       render: (text) => {
-        return text ? moment(text).format('YYYY年MM月DD日  HH:mm:ss') : null;
+        return text ? dayjs(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) {
@@ -53,59 +69,61 @@ export default function DeviceMaintainDetail() {
         .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>
+      <div className={styles.detailBox}>
+        <span>
+          <label>设备位号:</label>
+          {DeviceCode}
+        </span>
+        <span>
+          <label>设备名称:</label>
+          {DeviceName}
+        </span>
+        <span>
+          <label>保养人:</label>
+          {getUser(Operators)}
+        </span>
+        <span>
+          <label>物料消耗:</label>
+          {MaterialConsumption}
+        </span>
+        <span>
+          <label>保养日期:</label>
+          {MaintainTime}
+        </span>
+        <span>
+          <label>是否润滑加油:</label>
+          {Lubrication === 1 ? '是' : '否'}
+        </span>
+        <span>
+          <label>是否拆检:</label>
+          {Check === 1 ? '是' : '否'}
+        </span>
+        <span>
+          <label>是否清洁:</label>
+          {Clean === 1 ? '是' : '否'}
+        </span>
+        <span>
+          <label>是否紧固:</label>
+          {Fasten === 1 ? '是' : '否'}
+        </span>
+        <span>
+          <label>是否除锈:</label>
+          {RustRemoval === 1 ? '是' : '否'}
+        </span>
+        <span>
+          <label>是否防腐:</label>
+          {AntiCorrosive === 1 ? '是' : '否'}
+        </span>
 
-        <span>评估分数:{EvaluationScore * 100}</span>
         <span>
-          保养备注:
+          <label>评估分数:</label>
+          {EvaluationScore * 100}
+        </span>
+        <span>
+          <label>保养备注:</label>
           {Note?.split('|').map((item) => (
             <div>{item}</div>
           ))}

+ 176 - 0
src/pages/DeviceManager/deviceRepairDetail.js

@@ -0,0 +1,176 @@
+import PageContent from '@/components/PageContent';
+import { useParams } from '@umijs/max';
+import { Table } from 'antd';
+import styles from './detail.less';
+const {
+  DeviceCode,
+  DeviceName,
+  Reason,
+  PlanTime,
+  RepairType,
+  IsPlan,
+  DifficultyLevel,
+  AcceptanceStatus,
+  EvaluationScore,
+  Operators,
+  RepairTime,
+  Desc,
+  MaterialConsumption,
+  AcceptorUser,
+  AcceptanceTime,
+  Level,
+  AcceptanceOpinion,
+  Note,
+  Files = [],
+} = JSON.parse(localStorage.repair || '{}');
+
+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 '';
+  };
+
+  return (
+    <PageContent closeable={false}>
+      <div className={styles.detailBox}>
+        <span>
+          <label>设备位号:</label>
+          {DeviceCode}
+        </span>
+        <span>
+          <label>维修人:</label>
+          {getUser(Operators)}
+        </span>
+        <span>
+          <label>设备名称:</label>
+          {DeviceName}
+        </span>
+        <span>
+          <label>维修日期:</label>
+          {RepairTime}
+        </span>
+        <span>
+          <label>维修原因:</label>
+          {Reason}
+        </span>
+        <span>
+          <label>维修内容简述:</label>
+          {Desc}
+        </span>
+
+        <span>
+          <label>计划日期:</label>
+          {PlanTime}
+        </span>
+        <span>
+          <label>物料消耗:</label>
+          {MaterialConsumption}
+        </span>
+
+        <span>
+          <label>维修方式:</label>
+          {RepairType}
+        </span>
+        <span>
+          <label>验收人:</label>
+          {AcceptorUser?.CName}
+        </span>
+
+        <span>
+          <label>是否计划内:</label>
+          {String(IsPlan) == 0 ? '否' : '是'}
+        </span>
+        <span>
+          <label>验收状态:</label>
+          {getStatus(AcceptanceTime, AcceptanceStatus)}
+        </span>
+
+        <span>
+          <label>难度级别:</label>
+          {DifficultyLevel}
+        </span>
+        <span>
+          <label>级别:</label>
+          {Level}
+        </span>
+        <span>
+          <label>维修状态:</label>
+          {AcceptanceStatus}
+        </span>
+        <span>
+          <label>验收意见:</label>
+          {AcceptanceOpinion}
+        </span>
+
+        <span>
+          <label>评估分数:</label>
+          {EvaluationScore * 100}
+        </span>
+        <span>
+          <label>保养备注:</label>
+          {Note?.split('|').map((item) => (
+            <div>{item}</div>
+          ))}
+        </span>
+      </div>
+      <Table
+        style={{ marginTop: '0.1rem' }}
+        dataSource={Files}
+        columns={columns}
+        pagination={false}
+      />
+    </PageContent>
+  );
+}

+ 10 - 1
src/pages/DeviceManager/index.js

@@ -292,7 +292,10 @@ const Device = ({ projectId }) => {
           columns={columnsRepair}
           pagination={false}
           onRow={(record, index) => ({
-            onClick: () => console.log(record),
+            onClick: () => {
+              localStorage.repair = JSON.stringify(record)
+              UnityAction.sendMsg("RepairDetail")
+            },
           })}
         />
       )}
@@ -303,6 +306,12 @@ const Device = ({ projectId }) => {
           dataSource={maintainData?.filter((item) => item.DeviceCode)}
           columns={columns}
           pagination={false}
+          onRow={(record, index) => ({
+            onClick: () => {
+              localStorage.maintain = JSON.stringify(record)
+              UnityAction.sendMsg("MaintainDetail")
+            },
+          })}
         />
       )}
     </div>