李程龙 3 年之前
父節點
當前提交
57f4b4b27c

+ 1 - 2
pages/weather/components/w-line-charts.vue

@@ -1,7 +1,7 @@
 <template>
 	<!-- 气象历史数据 折线统计图 -->
 	<view >
-		<ui-charts ref="wLineCharts" type="line" :ontouch="true" :opts="opts" :chartData="chartData">
+		<ui-charts ref="wLineCharts" type="line" :loadingType="0" :ontouch="true" :opts="opts" :chartData="chartData">
 		</ui-charts>
 	</view>
 </template>
@@ -18,7 +18,6 @@
 			return {
 				loading: true,
 				opts: {
-					loadingType: 0,
 					color: ["#317afd"],
 					padding: [10, 10, 0, 15],
 					enableScroll: true,

+ 1 - 1
pages/weather/details.vue

@@ -66,7 +66,7 @@
 		data() {
 			return {
 				deviceInfo: {}, // 设备信息
-				// 实时数据列表 { icon:'图标', text:'标题',valu7e:'值'}
+				// 实时数据列表 { icon:'图标', text:'标题',value:'值'}
 				latestList: [],
 				dayData: null, //当天24小时数据
 				dayDatas: [], // 24小时数据列表

+ 73 - 26
pages/worm/analyse.vue

@@ -5,26 +5,41 @@
 		<view class="ui-card px-13">
 			<!-- 选项框 -->
 			<view class="row-end mb">
-				<picker class="picker mr">
+			<!-- 	<picker mode='date' fields='year'  @chagne="changePestDate" class="picker mr">
 					<view class="picker-wrapper">
-						2022年
+						<view>{{pestDate}}</view>
 						<uni-icons type="bottom" :size="12" color="#DDDDDD"></uni-icons>
 					</view>
+				</picker> -->
+				<picker mode="date" fields="year" @change="changePestDate">
+					<view class="uni-input">{{pestDate}}</view>
 				</picker>
-				<picker class="picker">
+				<picker class="picker" @change="changePestList" :range="pestList" >
 					<view class="picker-wrapper">
-						步甲
+						<view>{{pestItem}}</view>
 						<uni-icons type="bottom" :size="12" color="#DDDDDD"></uni-icons>
 					</view>
 				</picker>
 			</view>
 			<!-- 时期列表 -->
-			<view class="period-navs">
-				<view class="period-item" v-for="(period,index) in periodList" :key="index">
+			<view class="period-navs" v-if="pestInfo[pestItem]">
+				<view class="period-item start-time">
 					<view class="icon"></view>
-					<view class="title">{{period.title}}</view>
-					<view class="text">{{period.time}}</view>
-					<view class="text">数量:{{period.num}}</view>
+					<view class="title">始见期</view>
+					<view class="text">{{pestInfo[pestItem].startTime}}</view>
+					<view class="text"></view>
+				</view>
+				<view class="period-item high-time">
+					<view class="icon"></view>
+					<view class="title">高峰期</view>
+					<view class="text">{{pestInfo[pestItem].highTime}}</view>
+					<view class="text">数量:{{pestInfo[pestItem].highNum}}</view>
+				</view>
+				<view class="period-item end-ime">
+					<view class="icon"></view>
+					<view class="title">终见期</view>
+					<view class="text">{{pestInfo[pestItem].endTime}}</view>
+					<view class="text"></view>
 				</view>
 			</view>
 		</view>
@@ -48,14 +63,14 @@
 					</view>
 					<view class="percent">52%</view>
 				</view>
-			
+
 			</view>
 		</view>
-		
+
 		<!-- 虫害表格数据 -->
 		<view class="ui-card worm-table">
 			<ui-tabs :list="tabs" :active="1"></ui-tabs>
-			<uni-table class="table-style mt-12" ref="table" :loading="loading" border emptyText="暂无更多数据">
+			<!-- <uni-table class="table-style mt-12" ref="table" :loading="loading" border emptyText="暂无更多数据">
 				<uni-tr>
 					<uni-th width="150" align="center">日期</uni-th>
 					<uni-th width="150" align="center">姓名</uni-th>
@@ -70,7 +85,7 @@
 					</uni-td>
 					<uni-td align="center">{{ item.address }}</uni-td>
 				</uni-tr>
-			</uni-table>
+			</uni-table> -->
 			<!-- 页码 -->
 			<uni-pagination :total="50" title="标题文字" />
 			<!-- 页码end -->
@@ -80,13 +95,23 @@
 
 <script>
 	import {
-		getWormLampList
+		getPestStatisticsChart,
+		getPestRaiseInfo,
+		getPestImageSource,
+		getPestBaseData
 	} from '@/api/worm.js'
 	import areaCharts from './components/w-area-charts.vue'
 	import pieCharts from './components/w-pie-charts.vue'
 	export default {
 		data() {
 			return {
+				dId: '',// 设备id
+				//始见期选项
+				pestList: [], //始见期选项
+				pestInfo: {},
+				pestDate: (new Date()).getUTCFullYear(),
+				pestItem: '',
+				//始见期选项 end
 				pieData: {
 					series: [{
 						data: [{
@@ -146,7 +171,30 @@
 			areaCharts,
 			pieCharts
 		},
+		onLoad(options) {
+			this.dId='15';//options.id
+			this.getPestRaiseInfo();
+		},
 		methods: {
+			// 获取始见期数据
+			async getPestRaiseInfo() {
+				const res = await getPestRaiseInfo({
+					year: this.pestDate,
+					d_ids: this.dId,
+				});
+				console.log(res);
+				this.pestList = res.pest_list; //始见期选项
+				this.pestInfo = res.pest_info;
+				this.pestItem = this.pestList[0];
+			},
+			changePestDate(e){
+				console.log(e);
+			},
+			// 选择始见期类型
+			changePestList(e){
+				console.log(e);
+				this.pestItem = this.pestList[e.detail.value];
+			},
 			maskClick(e) {
 				console.log('----maskClick事件:', e);
 			}
@@ -162,19 +210,17 @@
 	}
 
 	.period-item {
-		width: 206rpx;
+		width: 200rpx;
 		height: 264rpx;
-		padding: 24rpx;
-		background-color: #FCF8FF;
-
-		.icon {
-			width: 80rpx;
-			height: 80rpx;
-			margin-bottom: 18rpx;
-			background-color: #95F9E7;
-			border-radius: 100%;
+		padding:122rpx 24rpx 24rpx;
+		background: url('/static/img/startTime.png') center center no-repeat;
+		background-size:200rpx 264rpx;
+		&.high-time{
+			background-image: url('/static/img/highTime.png');
+		}
+		&.end-time{
+			background-image: url('/static/img/endTime.png');
 		}
-
 		.title {
 			font-size: 32rpx;
 			font-weight: normal;
@@ -222,8 +268,9 @@
 
 		}
 	}
+
 	// 虫害表格数据
-	.worm-table{
+	.worm-table {
 		padding: 10rpx 24rpx 30rpx;
 		margin-bottom: 100rpx;
 		border-radius: 0;

+ 127 - 0
pages/worm/components/w-raise-card.vue

@@ -0,0 +1,127 @@
+<template>
+	<!-- 时期卡片组件-->
+	<view class="ui-card px-13">
+		<!-- 选项框 -->
+		<view class="row-end mb">
+			<picker mode='date' fields='year' @chagne="changePestDate" class="picker mr">
+				<view class="picker-wrapper">
+					<view>{{pestDate}}</view>
+					<uni-icons type="bottom" :size="12" color="#DDDDDD"></uni-icons>
+				</view>
+			</picker>
+			<picker class="picker" @change="changePestList" :range="pestList">
+				<view class="picker-wrapper">
+					<view>{{pestItem}}</view>
+					<uni-icons type="bottom" :size="12" color="#DDDDDD"></uni-icons>
+				</view>
+			</picker>
+		</view>
+		<!-- 时期列表 -->
+		<view class="period-navs" v-if="pestInfo[pestItem]">
+			<view class="period-item">
+				<view class="icon"></view>
+				<view class="title">始见期</view>
+				<view class="text">{{pestInfo[pestItem].startTime}}</view>
+				<view class="text"></view>
+			</view>
+			<view class="period-item">
+				<view class="icon"></view>
+				<view class="title">高峰期</view>
+				<view class="text">{{pestInfo[pestItem].highTime}}</view>
+				<view class="text">数量:{{pestInfo[pestItem].highNum}}</view>
+			</view>
+			<view class="period-item">
+				<view class="icon"></view>
+				<view class="title">终见期</view>
+				<view class="text">{{pestInfo[pestItem].endTime}}</view>
+				<view class="text"></view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	/**
+	 * 虫害始见期数据卡片
+	 */
+	export default {
+		name: 'w-raise-card',
+		data() {
+			return {
+				//始见期选项
+				pestList: [], //始见期选项
+				pestInfo: {},
+				pestDate: (new Date()).getUTCFullYear(),
+				pestItem: '',
+				//始见期选项 end
+			}
+		},
+		props: {
+			// 设备id
+			deviceId: [String, Number]
+		},
+
+		mounted() {
+			this.getPestRaiseInfo();
+		},
+		methods: {
+			// 获取始见期数据
+			async getPestRaiseInfo() {
+				const res = await getPestRaiseInfo({
+					year: this.pestDate,
+					d_ids: this.deviceId,
+				});
+				console.log(res);
+				this.pestList = res.pest_list; //始见期选项
+				this.pestInfo = res.pest_info;
+				this.pestItem = this.pestList[0];
+			},
+			changePestDate(e) {
+				console.log(e);
+			},
+			// 选择始见期类型
+			changePestList(e) {
+				this.pestItem = this.pestList[e.detail.value];
+			},
+		}
+	};
+</script>
+
+<style lang="scss">
+	// 时期样式
+	.period-navs {
+		display: flex;
+		justify-content: space-between;
+	}
+
+	.period-item {
+		width: 206rpx;
+		height: 264rpx;
+		padding: 24rpx;
+		background-color: #FCF8FF;
+
+		.icon {
+			width: 80rpx;
+			height: 80rpx;
+			margin-bottom: 18rpx;
+			background-color: #95F9E7;
+			border-radius: 100%;
+		}
+
+		.title {
+			font-size: 32rpx;
+			font-weight: normal;
+			color: #333333;
+			line-height: 44rpx;
+		}
+
+		.text {
+			margin-top: 10rpx;
+			font-size: 24rpx;
+			font-weight: normal;
+			color: #999999;
+			line-height: 34rpx;
+		}
+
+	}
+</style>

+ 5 - 3
pages/worm/details.vue

@@ -14,7 +14,7 @@
 		<!-- 设备卡片end -->
 		<!-- 导航选项 -->
 		<view class="ui-card  worm-nav">
-			<navigator :url="`image?id=${deviceId}`" class="worm-nav-item" hover-class="none">
+			<navigator :url="`image?id=${deviceImei}`" class="worm-nav-item" hover-class="none">
 				<image src="@/static/img/worm-nav-2.png" class="icon" mode="aspectFill"></image>
 				<view class="text">查看图片</view>
 			</navigator>
@@ -164,18 +164,20 @@
 		data() {
 			return {
 				deviceId: '', // 设备id
+				deviceImei:'',// 设备号
 				lampDetails:{},//设备详情
 				latestList:[],//实时列表
 			};
 		},
 		onLoad(options) {
-			this.deviceId = options.id;
+			this.deviceId = options.id; // 设备id
+			this.deviceImei = options.imei;// 设备号
 		},
 		methods: {
 			// 获取测报灯详情
 			async getLampDetails() {
 				let res = await getWormLampDetails({
-					device_id: this.deviceId
+					device_id: this.deviceImei
 				});
 				this.lampDetails=res;
 				// "is_online": 1, //在线状态   1在线 0离线

+ 0 - 2
pages/worm/history.vue

@@ -9,9 +9,7 @@
 					<view class="row-center time-btn">{{time.text}}</view>
 				</block>
 			</view>
-			
 		</view>
-
 		<!-- 统计图end -->
 		<!-- 历史数据列表 -->
 		<view class="ui-card history-panel">

+ 0 - 1
pages/worm/image.vue

@@ -4,7 +4,6 @@
 		<!-- 选择时间 -->
 		<uni-datetime-picker v-model="searchTime" type="daterange" rangeSeparator="-" @change="changeSearchTime" />
 		<!-- 选择时间end -->
-
 		<!-- 图片列表 -->
 		<view class="row wrap">
 			<block v-for="(item,index) in imageList" :key="index">

+ 8 - 4
pages/worm/index.vue

@@ -6,7 +6,7 @@
 		<!-- 搜索框end -->
 		<!-- 监测列表 -->
 		<block v-for="(item,index) in lampList" :key="index">
-			<view class="ui-card forecast-item" @click="openLampDetails(item.imei)">
+			<view class="ui-card forecast-item" @click="openLampDetails(item.d_id,item.imei)">
 				<view class="flex-1 info">
 					<view class="font-16  title" :class="item.is_online?'on':'off'">{{item.device_name}}</view>
 					<view class="text">设备ID:{{item.imei}}</view>
@@ -80,10 +80,14 @@
 				this.params.device_id = val;
 				this.refreshLampList();
 			},
-			// 打开虫情详情列表
-			openLampDetails(id) {
+			/**
+			 * 打开虫情详情列表
+			 * @param {String} id  设备id
+			 * @param {String} imei 设备号
+			 */
+			openLampDetails(id,imei) {
 				uni.navigateTo({
-					url: `details?id=${id}`
+					url: `details?id=${id}&imei=${imei}`
 				})
 			}
 		},

二進制
static/img/endTime.png


二進制
static/img/highTime.png


二進制
static/img/startTime.png