feat:武隆鲁渝协作示范村数字化赋能 app研发
This commit is contained in:
parent
2669fbe488
commit
28d7cfd800
@ -1,4 +1,4 @@
|
||||
import { View } from "@tarojs/components"
|
||||
import { View,Picker } from "@tarojs/components"
|
||||
import { useEffect, useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import TabWrapper from "../../components/customized/tabWrapper"
|
||||
@ -50,13 +50,22 @@ const EquipMent = () => {
|
||||
id: '3',
|
||||
},
|
||||
])
|
||||
const getdevice2=(id)=>{
|
||||
getdevice({pageNo:1,pageSize:10,baseId:id}).then(res=>{
|
||||
let a=new Date().getFullYear()
|
||||
let b=(new Date().getMonth()+1).toString().length>=2?new Date().getMonth()+1:0+(new Date().getMonth()+1).toString()
|
||||
let c=(new Date().getDate()).toString().length>=2?new Date().getDate():0+(new Date().getDate()).toString()
|
||||
const [date, setDate] = useState(a+'-'+b+'-'+c)
|
||||
function fn(data){
|
||||
let a2=data.substring(0,4)
|
||||
let b2 =data.substring(5,7)
|
||||
let c2= data.substring(8)
|
||||
return `${a2}-${b2}-${c2}`
|
||||
}
|
||||
const getdevice2=(id,time)=>{
|
||||
getdevice({pageNo:1,pageSize:10,baseId:id,createTime:time}).then(res=>{
|
||||
console.log(res,'获取数据');
|
||||
setDataList(res.data.list)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
getDeviceInfoCard({}).then(res=>{
|
||||
console.log(res,'获取基地');
|
||||
@ -65,21 +74,26 @@ const EquipMent = () => {
|
||||
id:index,
|
||||
id2:item.id
|
||||
})).reverse())
|
||||
getdevice2(res.data.list.reverse()[1].id)
|
||||
console.log('基地id', res.data.list[0].id);
|
||||
let time=fn(date)
|
||||
getdevice2(res.data.list[0].id,time)
|
||||
|
||||
})
|
||||
},[])
|
||||
const [selectedMenuId, setSelectedMenuId] = useState('all')
|
||||
|
||||
|
||||
|
||||
|
||||
const [refreshTrigger, setRefreshTrigger] = useState(false)
|
||||
function handleDateChange(e) {
|
||||
const value = e.detail.value
|
||||
console.log(value,'value');
|
||||
let a3= fn(value)
|
||||
setDate(value)
|
||||
getdevice2(topMenus[0].id,a3)
|
||||
}
|
||||
const refreshFunc = (): Promise<void> => {
|
||||
return new Promise((resolve, reject) => { resolve() })
|
||||
}
|
||||
return (
|
||||
<View className="px-1 h-full">
|
||||
<View className="px-1 h-full" style={{position:'relative',}}>
|
||||
<View className="h-full flex flex-col justify-start">
|
||||
<TabWrapper options={topMenus} selectedId={selectedMenuId} callback={setSelectedMenuId}></TabWrapper>
|
||||
<View className="pb-2" style={{ height: 'calc(100% - 2.4rem)', width: '100%' }}>
|
||||
@ -126,7 +140,9 @@ const EquipMent = () => {
|
||||
className="rounded-xl w-20 bg-green-500 text-center py-1"
|
||||
style={{ color: 'white' }}
|
||||
onClick={() => {
|
||||
Taro.navigateTo({ url: `/inspectionManager/inspection/index?id=${topMenus[1].id2}&categoryId=${item.categoryId}` })
|
||||
console.log(item,'设备');
|
||||
|
||||
Taro.navigateTo({ url: `/inspectionManager/inspection/index?id=${topMenus[2].id2}&categoryId=${item.categoryId}&time=${fn(date)}&name=${item.categoryName}` })
|
||||
}}
|
||||
>去巡检</View>
|
||||
</View>
|
||||
@ -136,6 +152,11 @@ const EquipMent = () => {
|
||||
</ScrollView>
|
||||
</View>
|
||||
</View>
|
||||
<Picker mode="date" value={date} onChange={handleDateChange} style={{ position:"absolute",right:'5px',top:'20px',color:'#c1c1c1',padding:'5px' }}>
|
||||
<View className="picker">
|
||||
当前选择:{date}
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { View, Image } from "@tarojs/components"
|
||||
import { View, Image,Picker } from "@tarojs/components"
|
||||
import { useEffect, useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import PageWrapper from "../../components/customized/pageWrapper"
|
||||
@ -14,8 +14,9 @@ const getCheckDeviceBySomet=(data)=>{
|
||||
const EquipMent = () => {
|
||||
const baseId = Taro.getCurrentInstance().router?.params.id || 0; // 基地id
|
||||
const categoryId2 = Taro.getCurrentInstance().router?.params.categoryId || 0; // 基地id
|
||||
|
||||
|
||||
const date2=Taro.getCurrentInstance().router?.params.time
|
||||
const name=Taro.getCurrentInstance().router?.params.name
|
||||
console.log(date2,'shijian');
|
||||
|
||||
const [selectedMenuId, setSelectedMenuId] = useState('all')
|
||||
const topMenus = [
|
||||
@ -44,8 +45,15 @@ const EquipMent = () => {
|
||||
useEffect(()=>{
|
||||
getList('0')
|
||||
},[])
|
||||
const [date, setDate] = useState(date2)
|
||||
function fn(data){
|
||||
let a2=data.substring(0,4)
|
||||
let b2 =data.substring(5,7)
|
||||
let c2= data.substring(8)
|
||||
return `${a2}-${b2}-${c2}`
|
||||
}
|
||||
const getList=(id)=>{
|
||||
getCheckDeviceBySomet({pageNo:1,pageSize:10,base:baseId,categoryId:categoryId2,inspectionState:id }).then(res=>{
|
||||
getCheckDeviceBySomet({pageNo:1,pageSize:10,base:baseId,createTime:fn(date),deviceStatus:categoryId2,inspectionState:id }).then(res=>{
|
||||
console.log(res,'huoqushuju');
|
||||
setDataList(res.data.list)
|
||||
})
|
||||
@ -55,13 +63,19 @@ const EquipMent = () => {
|
||||
console.log(id,'tab id');
|
||||
|
||||
if(id=='1'){
|
||||
getList('0')
|
||||
}else{
|
||||
getList('1')
|
||||
}else{
|
||||
getList('0')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleDateChange(e) {
|
||||
const value = e.detail.value
|
||||
setDate(value)
|
||||
}
|
||||
return (
|
||||
<PageWrapper title="气象站">
|
||||
<PageWrapper title={name}>
|
||||
<View className="p-1 h-full">
|
||||
<View className="h-full flex flex-col">
|
||||
<View className="flex px-2 py-1">
|
||||
@ -83,7 +97,7 @@ const EquipMent = () => {
|
||||
dataList.map(item => {
|
||||
return (
|
||||
<View
|
||||
className="py-2 pt-0 rounded-md shadow-xl bg-white relative"
|
||||
className='py-2 pt-0 rounded-md shadow-xl bg-white relative'
|
||||
>
|
||||
<Image src={'https://picx.zhimg.com/70/v2-76efadc2e5b562f6f727521aedbb31ef_1440w.image?source=172ae18b&biz_tag=Post'} className="w-full h-[6rem] rounded-md"></Image>
|
||||
<View className="text-lg px-4 text-bold">{item.equName}</View>
|
||||
@ -93,14 +107,14 @@ const EquipMent = () => {
|
||||
className="rounded-xl w-20 bg-green-500 text-center py-1"
|
||||
style={{ color: 'white' }}
|
||||
onClick={() => {
|
||||
Taro.navigateTo({ url: '/iotManager/weatherStation/index?id=' + item.id})
|
||||
Taro.navigateTo({ url: '/inspectionManager/inspectionLog/index?id=' + item.equNum})
|
||||
}}
|
||||
>巡检日志</View>
|
||||
<View
|
||||
className="rounded-xl w-20 bg-green-500 text-center py-1"
|
||||
style={{ color: 'white' }}
|
||||
onClick={() => {
|
||||
Taro.navigateTo({ url: '/iotManager/weatherStation/index?id=' + item.id})
|
||||
Taro.navigateTo({ url: '/inspectionManager/inspectionContent/index?id=' + item.id})
|
||||
}}
|
||||
>去巡检</View>
|
||||
</View>
|
||||
@ -117,6 +131,11 @@ const EquipMent = () => {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<Picker mode="date" value={date} onChange={handleDateChange} style={{ position:"absolute",right:'20px',top:'50px',color:'#c1c1c1',padding:'5px' }}>
|
||||
<View className="picker">
|
||||
当前选择:{date}
|
||||
</View>
|
||||
</Picker>
|
||||
</PageWrapper>
|
||||
|
||||
)
|
||||
|
@ -1,7 +1,28 @@
|
||||
import { Input, View } from "@tarojs/components"
|
||||
import PageWrapper from "../../components/customized/pageWrapper";
|
||||
import { request } from "../../config/axios"
|
||||
import { useEffect } from "react";
|
||||
import Taro from "@tarojs/taro"
|
||||
|
||||
|
||||
//获取数据
|
||||
const getPageByCondition=(data)=>{
|
||||
return request({
|
||||
url:'/agriculture/check-logs/pageByCondition',
|
||||
method:'GET',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
const InspectionLog = () => {
|
||||
const baseId = Taro.getCurrentInstance().router?.params.id || 0; // 基地id
|
||||
//获取数据
|
||||
useEffect(()=>{
|
||||
getPageByCondition({pageNo:1,pageSize:100,equNum:baseId,inspectionState:'1'}).then(res=>{
|
||||
console.log(res,'获取数据');
|
||||
|
||||
})
|
||||
},[])
|
||||
return (
|
||||
<PageWrapper title="巡检日志">
|
||||
<View className="h-[3rem] flex items-center px-7" style={{ color: 'white' }}>
|
||||
|
Loading…
Reference in New Issue
Block a user