|
@@ -5,13 +5,14 @@ import withLayout from '@/layouts'
|
5
|
5
|
import { getMachineryList } from '@/services/machinery'
|
6
|
6
|
import { useModel } from "@/store"
|
7
|
7
|
import CustomNav from "@/components/CustomNav"
|
8
|
|
-import MachineryModel from './Model'
|
9
|
8
|
import m1 from '@/assets/machinery/greenMachinery.png'
|
10
|
9
|
import m2 from '@/assets/machinery/orangeMachinery.png'
|
|
10
|
+import m3 from '@/assets/machinery/repairMachinery.png'
|
|
11
|
+import MachineryModel from './Model'
|
11
|
12
|
import './style.less'
|
12
|
13
|
|
13
|
14
|
|
14
|
|
-export default withLayout((props) => {
|
|
15
|
+export default withLayout((props) => {
|
15
|
16
|
const { router } = props
|
16
|
17
|
const { id } = router.params
|
17
|
18
|
const [show, setShow] = useState(false)
|
|
@@ -19,8 +20,8 @@ export default withLayout((props) => {
|
19
|
20
|
const [machineryList, setMachineryList] = useState([])
|
20
|
21
|
const [markerList, setMarkerList] = useState([])
|
21
|
22
|
const [current, setCurrent] = useState()
|
22
|
|
- const [lot,setLot]=useState(112.106514)
|
23
|
|
- const [lat,setLat]=useState(32.685927)
|
|
23
|
+ const [lot, setLot] = useState(112.106514)
|
|
24
|
+ const [lat, setLat] = useState(32.685927)
|
24
|
25
|
|
25
|
26
|
const locList = [
|
26
|
27
|
{
|
|
@@ -74,13 +75,13 @@ export default withLayout((props) => {
|
74
|
75
|
const goList = () => {
|
75
|
76
|
Taro.navigateTo({ url: '/pages/machineryList/index' });
|
76
|
77
|
}
|
77
|
|
- const changeRegion=()=>{
|
|
78
|
+ const changeRegion = () => {
|
78
|
79
|
setShow(false)
|
79
|
80
|
}
|
80
|
|
- useEffect(()=>{
|
81
|
|
- if (id&&machineryList&&markerList.length!=0) {
|
82
|
|
- machineryList.forEach((item,index)=>{
|
83
|
|
- if(item.machineryId==id){
|
|
81
|
+ useEffect(() => {
|
|
82
|
+ if (id && machineryList && markerList.length != 0) {
|
|
83
|
+ machineryList.forEach((item, index) => {
|
|
84
|
+ if (item.machineryId == id) {
|
84
|
85
|
setLot(markerList[index].longitude)
|
85
|
86
|
setLat(markerList[index].latitude)
|
86
|
87
|
setCurrent(machineryList[index])
|
|
@@ -89,7 +90,7 @@ export default withLayout((props) => {
|
89
|
90
|
}
|
90
|
91
|
})
|
91
|
92
|
}
|
92
|
|
- },[id, machineryList, markerList])
|
|
93
|
+ }, [id, machineryList, markerList])
|
93
|
94
|
useEffect(() => {
|
94
|
95
|
getMachineryList({ location: location }).then((res) => {
|
95
|
96
|
setMachineryList(res.records)
|
|
@@ -98,7 +99,7 @@ export default withLayout((props) => {
|
98
|
99
|
id: index,
|
99
|
100
|
longitude: locList[index % 10].longitude,
|
100
|
101
|
latitude: locList[index % 10].latitude,
|
101
|
|
- iconPath: item.jobStatus?m1:m2,
|
|
102
|
+ iconPath: item.status == 0 ? m3 : (item.jobStatus || item.jobStatus == 3) ? m2 : m1,
|
102
|
103
|
width: 50,
|
103
|
104
|
height: 50
|
104
|
105
|
}
|