|
@@ -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
|