|
@@ -75,38 +75,7 @@ export default (props) => {
|
75
|
75
|
useEffect(() => {
|
76
|
76
|
const params = deviceType ? { deviceType } : undefined;
|
77
|
77
|
getDeviceMachineryList(params).then((res) => {
|
78
|
|
- const locIds = [];
|
79
|
|
- const locList = [];
|
80
|
|
- const list = res || [];
|
81
|
|
-
|
82
|
|
- for (let item of list) {
|
83
|
|
- if (item.location && item.location.indexOf('0.0') === -1) {
|
84
|
|
- locIds.push(item.machineryId);
|
85
|
|
- locList.push(item.location);
|
86
|
|
- }
|
87
|
|
- }
|
88
|
|
-
|
89
|
|
- if (locList.length > 0) {
|
90
|
|
- // 高德接口, 请求地址的描述
|
91
|
|
- regeo({ location: locList.join('|') })
|
92
|
|
- .then((regs) => {
|
93
|
|
- if (regs.status === '1') {
|
94
|
|
- regs.regeocodes.forEach((addrs, inx) => {
|
95
|
|
- const addr = addrs['formatted_address'];
|
96
|
|
- const addressComponent = addrs.addressComponent;
|
97
|
|
- const machine = list.filter((x) => x.machineryId === locIds[inx])[0];
|
98
|
|
- machine.loc = addr.replace(addressComponent.province, ''); // 去掉省
|
99
|
|
- });
|
100
|
|
- }
|
101
|
|
-
|
102
|
|
- setMachines(list);
|
103
|
|
- })
|
104
|
|
- .catch((er) => {
|
105
|
|
- console.error(er);
|
106
|
|
-
|
107
|
|
- setMachines(list);
|
108
|
|
- });
|
109
|
|
- }
|
|
78
|
+ setMachines(res || []);
|
110
|
79
|
});
|
111
|
80
|
}, [deviceType]);
|
112
|
81
|
|
|
@@ -135,7 +104,7 @@ export default (props) => {
|
135
|
104
|
<div id={Styles['particles-js']} />
|
136
|
105
|
<div className={Styles['grail-layout']}>
|
137
|
106
|
<div className={Styles['grail-header']}>
|
138
|
|
- <ScreenHeader weather={weather} />
|
|
107
|
+ <ScreenHeader title="作业监管" weather={weather} />
|
139
|
108
|
</div>
|
140
|
109
|
<div className={classNames(Styles['grail-container'], Styles['mg-tp-30'])}>
|
141
|
110
|
<div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
|