Yansen 2 年之前
父節點
當前提交
5f83a12bb7
共有 2 個檔案被更改,包括 24 行新增0 行删除
  1. 18
    0
      src/pages/Machinery/Sensing/index.jsx
  2. 6
    0
      src/services/device.js

+ 18
- 0
src/pages/Machinery/Sensing/index.jsx 查看文件

8
   addRawDevice,
8
   addRawDevice,
9
   deleteRawDevice,
9
   deleteRawDevice,
10
   syncLoc,
10
   syncLoc,
11
+  syncMachine,
11
 } from '@/services/device';
12
 } from '@/services/device';
12
 import List from './components/List';
13
 import List from './components/List';
13
 import MaBind from './components/MaBind';
14
 import MaBind from './components/MaBind';
17
   const [open, setOpen] = useState(false);
18
   const [open, setOpen] = useState(false);
18
   const [syncing, setSyncing] = React.useState(false);
19
   const [syncing, setSyncing] = React.useState(false);
19
   const [syncing2, setSyncing2] = React.useState(false);
20
   const [syncing2, setSyncing2] = React.useState(false);
21
+  const [syncing3, setSyncing3] = React.useState(false);
20
   const [device, setDevice] = useState();
22
   const [device, setDevice] = useState();
21
   const listRef = useRef();
23
   const listRef = useRef();
22
   const actRef = useRef();
24
   const actRef = useRef();
105
     setOpen(true);
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
   const onSyncLoc = ({ deviceType, deviceNo }) => {
123
   const onSyncLoc = ({ deviceType, deviceNo }) => {
109
     const hide = message.loading('请稍候...', 0);
124
     const hide = message.loading('请稍候...', 0);
110
     syncLoc({ deviceType, deviceNo })
125
     syncLoc({ deviceType, deviceNo })
152
           <Button ghost key={3} type="primary" loading={syncing2} onClick={onSyncFeiFang}>
167
           <Button ghost key={3} type="primary" loading={syncing2} onClick={onSyncFeiFang}>
153
             同步飞防
168
             同步飞防
154
           </Button>,
169
           </Button>,
170
+          <Button ghost key={4} type="primary" loading={syncing3} onClick={onSyncMachine}>
171
+            同步农机
172
+          </Button>,
155
         ]}
173
         ]}
156
       />
174
       />
157
       <Modal
175
       <Modal

+ 6
- 0
src/services/device.js 查看文件

82
  * @returns
82
  * @returns
83
  */
83
  */
84
 export const syncLoc = (params) => request('/raw-device/sync-loc', { method: 'put', params });
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');