fangmingyue 2 anos atrás
pai
commit
c4253b90f0
1 arquivos alterados com 14 adições e 18 exclusões
  1. 14
    18
      src/pages/SystemManagement/Sensing/index.jsx

+ 14
- 18
src/pages/SystemManagement/Sensing/index.jsx Ver arquivo

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