fangmingyue 2 yıl önce
ebeveyn
işleme
c4253b90f0
1 değiştirilmiş dosya ile 14 ekleme ve 18 silme
  1. 14
    18
      src/pages/SystemManagement/Sensing/index.jsx

+ 14
- 18
src/pages/SystemManagement/Sensing/index.jsx Dosyayı Görüntüle

@@ -2,11 +2,11 @@ import React, { useState, useEffect, useRef } from 'react';
2 2
 import { Button, Modal, Select, Form, message } from 'antd';
3 3
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 4
 import moment from 'moment';
5
-import { history } from 'umi';
6 5
 import PageTable from '@/components/PageTable';
7 6
 import { getDeviceList, deleteDevice, addDevice } from '@/services/device';
8 7
 import { getMachineryList } from '@/services/machinery';
9 8
 import { getMachineryTypeList } from '@/services/machineryType';
9
+import { Link } from 'umi';
10 10
 
11 11
 const formatterTime = (val) => {
12 12
   return val && val !== '-' ? moment(val).format('YYYY-MM-DD') : '-';
@@ -20,7 +20,6 @@ export default (props) => {
20 20
   const [loading, setLoading] = useState(false);
21 21
   const [machineryId, setMachineryId] = useState();
22 22
   const [device, setDeviceList] = useState();
23
-  const [deviceId, setDeviceId] = useState();
24 23
   const actionRef = useRef();
25 24
   const [machineryTypeList, setMachineryTypeList] = useState([]);
26 25
   const [typeId, setTypeId] = useState();
@@ -28,10 +27,6 @@ export default (props) => {
28 27
   const { Option } = Select;
29 28
   const FormItem = Form.Item;
30 29
 
31
-  const goBack = () => {
32
-    history.goBack();
33
-  };
34
-
35 30
   //列表编辑
36 31
   const handelEdit = (val) => {
37 32
     if (val.machineryId != null) {
@@ -42,7 +37,7 @@ export default (props) => {
42 37
         okText: '确认',
43 38
         cancelText: '取消',
44 39
         onOk () {
45
-          deleteDevice(machineryId)
40
+          deleteDevice(val.deviceId)
46 41
             .then(() => {
47 42
               setLoading(false);
48 43
               message.success(`解绑成功`);
@@ -66,8 +61,6 @@ export default (props) => {
66 61
 
67 62
   //绑定弹窗关闭
68 63
   const onCancel = () => {
69
-    setMachineryId();
70
-    form.resetFields();
71 64
     setEditModal(false);
72 65
   };
73 66
 
@@ -79,7 +72,7 @@ export default (props) => {
79 72
       setLoading(false);
80 73
       message.success(`绑定成功`);
81 74
       actionRef.current.reload();
82
-      goBack();
75
+      onCancel();
83 76
     });
84 77
   };
85 78
 
@@ -132,9 +125,17 @@ export default (props) => {
132 125
       title: '在线状态',
133 126
       dataIndex: 'onlineStatus',
134 127
       key: 'onlineStatus',
135
-      render: (_, record) => {
136
-        return record.onlineStatus === 1 ? '在线' : '离线';
128
+      valueEnum: {
129
+        1: {
130
+          text: '在线',
131
+        },
132
+        0: {
133
+          text: '离线',
134
+        },
137 135
       },
136
+      // render: (_, record) => {
137
+      //   return record.onlineStatus === 1 ? '在线' : '离线';
138
+      // },
138 139
     },
139 140
     {
140 141
       title: '注册时间',
@@ -155,12 +156,7 @@ export default (props) => {
155 156
       valueType: 'option',
156 157
       width: 160,
157 158
       render: (_, record) => [
158
-        <Button type="link" style={{ padding: 0 }} key={1}>
159
-          查看作业
160
-        </Button>,
161
-        <Button type="link" style={{ padding: 0 }} key={2}>
162
-          修改
163
-        </Button>,
159
+        <Link to={`/Machinery/OperationStatistics`} key={2} >查看作业</Link>,
164 160
         <Button style={{ padding: 0 }} type="link" key={3} onClick={() => handelEdit(record)}>
165 161
           {record.machineryId === null ? '绑定' : '解绑'}
166 162
         </Button>,