Yansen 2 yıl önce
ebeveyn
işleme
5f83a12bb7
2 değiştirilmiş dosya ile 24 ekleme ve 0 silme
  1. 18
    0
      src/pages/Machinery/Sensing/index.jsx
  2. 6
    0
      src/services/device.js

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

@@ -8,6 +8,7 @@ import {
8 8
   addRawDevice,
9 9
   deleteRawDevice,
10 10
   syncLoc,
11
+  syncMachine,
11 12
 } from '@/services/device';
12 13
 import List from './components/List';
13 14
 import MaBind from './components/MaBind';
@@ -17,6 +18,7 @@ export default (props) => {
17 18
   const [open, setOpen] = useState(false);
18 19
   const [syncing, setSyncing] = React.useState(false);
19 20
   const [syncing2, setSyncing2] = React.useState(false);
21
+  const [syncing3, setSyncing3] = React.useState(false);
20 22
   const [device, setDevice] = useState();
21 23
   const listRef = useRef();
22 24
   const actRef = useRef();
@@ -105,6 +107,19 @@ export default (props) => {
105 107
     setOpen(true);
106 108
   };
107 109
 
110
+  // 同步农机
111
+  const onSyncMachine = () => {
112
+    setSyncing3(true);
113
+    syncMachine()
114
+      .then((res) => {
115
+        setSyncing3(false);
116
+        message.success('同步完成');
117
+      })
118
+      .catch(() => {
119
+        setSyncing3(false);
120
+      });
121
+  };
122
+
108 123
   const onSyncLoc = ({ deviceType, deviceNo }) => {
109 124
     const hide = message.loading('请稍候...', 0);
110 125
     syncLoc({ deviceType, deviceNo })
@@ -152,6 +167,9 @@ export default (props) => {
152 167
           <Button ghost key={3} type="primary" loading={syncing2} onClick={onSyncFeiFang}>
153 168
             同步飞防
154 169
           </Button>,
170
+          <Button ghost key={4} type="primary" loading={syncing3} onClick={onSyncMachine}>
171
+            同步农机
172
+          </Button>,
155 173
         ]}
156 174
       />
157 175
       <Modal

+ 6
- 0
src/services/device.js Dosyayı Görüntüle

@@ -82,3 +82,9 @@ export const deleteRawDevice = (id) => request(`/raw-device/${id}`, { method: 'D
82 82
  * @returns
83 83
  */
84 84
 export const syncLoc = (params) => request('/raw-device/sync-loc', { method: 'put', params });
85
+
86
+/**
87
+ * 同步农机
88
+ * @returns
89
+ */
90
+export const syncMachine = () => request('/bind/sync-machine');