合并冲突

This commit is contained in:
2090205686@qq.com 2025-05-20 17:51:57 +08:00
commit 2e057d7014
48 changed files with 1194 additions and 296 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
export default {
// 模拟获取商品列表
getProducts: () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve([
{ id: 1, name: '耿马绿色蔬菜', imageUrl: 'images/brand/11.png' },
{ id: 2, name: '云南高山茶', imageUrl: 'images/brand/12.png' },
{ id: 3, name: '新疆大枣', imageUrl: 'images/brand/13.png' },
{ id: 4, name: '东北大米', imageUrl: 'images/brand/14.png' },
{ id: 5, name: '山东苹果', imageUrl: 'images/brand/15.png' },
{ id: 6, name: '四川泡菜', imageUrl: 'images/brand/16.png' },
{ id: 7, name: '江苏阳澄湖大闸蟹', imageUrl: 'images/brand/11.png' },
{ id: 8, name: '海南椰子', imageUrl: 'images/brand/12.png' },
{ id: 9, name: '广东早茶', imageUrl: 'images/brand/13.png' },
{ id: 10, name: '北京烤鸭', imageUrl: 'images/brand/14.png' },
{ id: 11, name: '西藏青稞酒', imageUrl: 'images/brand/15.png' },
{ id: 12, name: '青海牦牛肉', imageUrl: 'images/brand/16.png' },
]);
}, 500); // 模拟网络延迟
});
},
};

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -127,6 +127,12 @@ export const constantRoutes = [
name: 'bugInspection', name: 'bugInspection',
meta: { title: '病虫害监测' }, meta: { title: '病虫害监测' },
}, },
{
path: '/sub-operation-service/smartFarm/envInspection',
component: () => import('@/views/smartFarm/inspection/envInspection.vue'),
name: 'envInspection',
meta: { title: '环境监测' },
},
{ {
path: '/sub-operation-service/smartFarm/growSeedlings', path: '/sub-operation-service/smartFarm/growSeedlings',
component: () => import('@/views/smartFarm/growSeedlings/index.vue'), component: () => import('@/views/smartFarm/growSeedlings/index.vue'),

View File

@ -1,67 +1,100 @@
<template> <template>
<el-page-header> <el-row :gutter="20" class="content-box">
<template #breadcrumb> <el-col v-for="product in products" :key="product.id" :span="6">
<el-breadcrumb separator="·"> <el-card class="box-card" :body-style="{ padding: '8px', height: '100%' }">
<el-breadcrumb-item :to="{ path: './page-header.html' }"> 使用申请 </el-breadcrumb-item> <div class="flex-column">
<el-breadcrumb-item>我要申请</el-breadcrumb-item> <img :src="product.img" alt="商品图" class="img" />
</el-breadcrumb> <div class="flex-1 flex-around">
</template> <p>{{ product.name }}</p>
</el-page-header> <el-button type="success" class="button">我要申请</el-button>
<el-space class="content-box" wrap> </div>
<el-card v-for="o in 12" :key="o" class="box-card"> </div>
<div style="height: 100%" class="flex-clomn"> </el-card>
<img :src="url" alt="" class="img" /> </el-col>
<p>耿马绿色蔬菜</p> </el-row>
<el-button class="button">我要申请</el-button>
</div>
</el-card>
</el-space>
</template> </template>
<script setup> <script setup>
const goBack = () => { import { ref, onMounted } from 'vue';
console.log('go back'); import productsApi from '@/apis/products';
import { getAssetsFile } from '@/utils/index.js';
const url = 'https://via.placeholder.com/182';
const products = ref([]);
//
const fetchProducts = async () => {
try {
const data = await productsApi.getProducts();
const processedData = data.map((item) => {
return {
...item,
img: getAssetsFile(item.imageUrl), //
};
});
products.value = processedData;
} catch (error) {
console.error('获取商品数据失败:', error);
}
}; };
//
onMounted(() => {
fetchProducts();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.content-box { .content-box {
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box; row-gap: 20px;
}
.box-card { .box-card {
box-shadow: none; width: 100%;
width: 224px; height: 334px;
height: 334px; border-radius: 16px;
background: #ffffff; padding: 0;
border-radius: 16px; box-shadow: none;
padding: 8;
.flex-clomn { .flex-column {
display: flex; height: 100%;
flex-direction: column; display: flex;
gap: 8; flex-direction: column;
} justify-content: space-between;
p { align-items: center;
text-align: center; padding: 0;
font-size: 20px; }
font-weight: 700;
} .flex-around {
display: flex;
.img { flex-direction: column;
width: 182px; justify-content: space-around;
height: 182px; align-items: center;
} }
.button {
width: 96px; .flex-1 {
height: 40px; flex: 1;
background: #25bf82; }
border-radius: 8px;
align-self: center; .flex-column p {
color: #fff; margin: 0;
} font-size: 20px;
font-weight: 700;
}
.img {
width: 100%;
aspect-ratio: 1 / 1;
object-fit: cover;
border-radius: 8px;
}
.button {
width: 96px;
height: 40px;
} }
// .content-box::-webkit-scrollbar {
// display: none; /* */
// }
} }
</style> </style>

View File

@ -1,179 +1,180 @@
<template> <template>
<div class="usage-monitor"> <div class="usage-monitor">
<!-- 状态筛选 --> <!-- 顶部 TabPane居中显示 -->
<el-tabs v-model="activeStatus" class="mb-24"> <div class="tabs-wrapper">
<el-tab-pane label="在售中" name="onSale" /> <el-tabs v-model="activeTab" type="card" class="centered-tabs">
<el-tab-pane label="未上架" name="notListed" /> <el-tab-pane label="在售中" name="onSale" />
<el-tab-pane label="已失效" name="expired" /> <el-tab-pane label="未上架" name="offShelf" />
</el-tabs> <el-tab-pane label="已失效" name="expired" />
</el-tabs>
</div>
<!-- 商品列表 --> <!-- 列表内容 -->
<el-row :gutter="16"> <div class="list-wrapper">
<el-col v-for="product in filteredProducts" :key="product.id" :xs="24" :sm="12" :md="8" :lg="6" class="mb-16"> <div v-for="(p, idx) in filteredProducts" :key="p.id" class="list-item" :class="{ 'has-border': idx > 0 }">
<el-card class="product-card"> <!-- 商品图 -->
<!-- 商品状态 --> <img class="item-img" :src="p.img" alt="商品图" />
<div class="status-tag">
<el-tag :type="statusMap[product.status]" size="small">
{{ product.statusLabel }}
</el-tag>
</div>
<!-- 商品信息 --> <!-- 名称 + 月售/库存 -->
<div class="product-content"> <div class="item-info">
<h4 class="product-name">{{ product.name }}</h4> <div class="item-name">{{ p.name }}</div>
<div class="item-stats">月售 {{ p.monthlySales }} · 库存 {{ p.stock }}</div>
</div>
<div class="sales-info"> <!-- 价格 -->
<div class="data-item"> <div class="item-price">¥ {{ p.price }} /kg</div>
<span class="label">月售</span>
<span class="value">{{ product.monthlySales }}</span>
</div>
<div class="data-item">
<span class="label">库存</span>
<span class="value">{{ product.stock }}</span>
</div>
</div>
<div class="price"> <!-- 操作按钮 -->
{{ product.price }} <div class="item-actions">
</div> <el-button size="small" @click="onInspect(p)">抽查</el-button>
</div> <el-button size="small" type="danger" @click="onRevoke(p)">取消授权</el-button>
</div>
<!-- 操作按钮 --> <!-- 右侧状态 -->
<div class="product-actions"> <div class="item-status" :class="statusClass(activeTab)">
<el-button v-if="product.status !== 'expired'" size="small" @click="handleInspect(product)">抽查</el-button> {{ tabLabels[activeTab] }}
<el-button v-if="product.status === 'onSale'" size="small" type="danger" plain @click="handleRevoke(product)">取消授权</el-button> </div>
</div> </div>
</el-card> </div>
</el-col>
</el-row>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
const activeStatus = ref('onSale'); const activeTab = ref('onSale');
// el-tag const tabLabels = {
const statusMap = { onSale: '在售中',
onSale: 'success', offShelf: '未上架',
notListed: 'info', expired: '已失效',
expired: 'danger',
}; };
// //
const products = ref([ const products = ref([
{ {
id: 1, id: 1,
name: '耿马镇沙瓢西红柿', name: '耿马镇沙疆西红柿',
img: 'https://via.placeholder.com/80',
monthlySales: 999, monthlySales: 999,
stock: 10000, stock: 10000,
price: '¥3.0/kg', price: 3.0,
status: 'onSale', status: 'onSale',
statusLabel: '在售中',
}, },
{ {
id: 2, id: 2,
name: '昭通乡土黄瓜', name: '耿马镇沙疆土豆',
monthlySales: 750, img: 'https://via.placeholder.com/80',
stock: 8500, monthlySales: 123,
price: '¥2.5/kg', stock: 5000,
price: 2.5,
status: 'onSale', status: 'onSale',
statusLabel: '在售中',
}, },
{ {
id: 3, id: 3,
name: '昆明有机苹果', name: '彩椒南瓜混合',
monthlySales: 450, img: 'https://via.placeholder.com/80',
stock: 5000, monthlySales: 456,
price: '¥6.0/kg', stock: 8000,
status: 'notListed', // notListed price: 4.2,
statusLabel: '未上架', status: 'offShelf',
},
{
id: 4,
name: '楚雄散养鸡蛋',
monthlySales: 1200,
stock: 20000,
price: '¥8.0/斤',
status: 'onSale',
statusLabel: '在售中',
}, },
//
]); ]);
// // Tab
const filteredProducts = computed(() => { const filteredProducts = computed(() => products.value.filter((p) => p.status === activeTab.value));
return products.value.filter((item) => item.status === activeStatus.value);
});
// //
const handleInspect = (product) => { const onInspect = (p) => {
console.log('抽查商品:', product); console.log('抽查商品', p);
};
const onRevoke = (p) => {
console.log('取消授权', p);
}; };
const handleRevoke = (product) => { //
console.log('取消授权:', product); const statusClass = (tab) => {
if (tab === 'offShelf') return 'text-warning';
if (tab === 'expired') return 'text-danger';
return 'text-success';
}; };
</script> </script>
<style lang="scss" scoped> <style scoped lang="scss">
.usage-monitor { .usage-monitor {
padding: 20px; padding: 20px;
background: #fff;
.mb-24 { .tabs-wrapper {
display: flex;
justify-content: center;
margin-bottom: 24px; margin-bottom: 24px;
.centered-tabs {
width: 600px; /* 根据实际需要调整宽度 */
.el-tabs__header {
justify-content: center;
}
}
} }
.product-card { .list-wrapper {
position: relative; .list-item {
margin-bottom: 16px; display: grid;
transition: box-shadow 0.3s; grid-template-columns: 80px 1fr auto auto 80px;
align-items: center;
&:hover { padding: 16px 0;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); &.has-border {
} border-top: 1px solid #ebeef5;
.status-tag {
position: absolute;
top: 12px;
right: 12px;
}
.product-content {
.product-name {
margin: 0 0 12px;
font-size: 16px;
color: #303133;
} }
.sales-info { .item-img {
display: flex; width: 80px;
gap: 20px; height: 80px;
margin-bottom: 12px; object-fit: cover;
border-radius: 8px;
}
.data-item { .item-info {
.label { padding-left: 16px;
color: #909399; .item-name {
margin-right: 4px; font-size: 16px;
} font-weight: 500;
.value { margin-bottom: 8px;
font-weight: 500; }
} .item-stats {
color: #909399;
font-size: 14px;
} }
} }
.price { .item-price {
color: #f56c6c;
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
color: #67c23a;
text-align: right;
padding: 0 16px;
} }
}
.product-actions { .item-actions {
margin-top: 16px; display: flex;
display: flex; gap: 8px;
gap: 8px; }
justify-content: flex-end;
.item-status {
text-align: right;
font-size: 14px;
&.text-success {
color: #67c23a;
}
&.text-warning {
color: #e6a23c;
}
&.text-danger {
color: #f56c6c;
}
}
} }
} }
} }

View File

@ -6,7 +6,7 @@
<el-menu v-model:default-active="activeMenu" class="aside-menu" @select="handleMenuSelect"> <el-menu v-model:default-active="activeMenu" class="aside-menu" @select="handleMenuSelect">
<el-menu-item index="1"> <el-menu-item index="1">
<el-icon><Document /></el-icon> <el-icon><Document /></el-icon>
<span>申请</span> <span>使用申请</span>
</el-menu-item> </el-menu-item>
<el-menu-item index="2"> <el-menu-item index="2">

View File

@ -0,0 +1,266 @@
<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { getAssetsFile } from '@/utils/index.js';
import * as echarts from 'echarts';
// DOM
const chartRef2 = ref(null);
// ECharts
let chartInstance = null;
//
const colorList = ['#3685FE', '#FFD500', '#25BF82', '#FE4066'];
// x
const xData = ['1月', '2月', '3月', '4月', '5月', '6月'];
/* --------------- methods --------------- */
// #region
//
const option = {
backgroundColor: '#fff',
title: {
text: '',
textStyle: {
fontSize: 12,
fontWeight: 400,
},
left: 'center',
top: '5%',
},
legend: {
icon: 'circle',
top: '5%',
right: '5%',
itemWidth: 6,
itemGap: 20,
textStyle: {
color: '#556677',
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
label: {
show: true,
backgroundColor: '#fff',
color: '#556677',
borderColor: 'rgba(0,0,0,0)',
shadowColor: 'rgba(0,0,0,0)',
shadowOffsetY: 0,
},
lineStyle: {
width: 0,
},
},
backgroundColor: '#fff',
textStyle: {
color: '#5c6c7c',
},
padding: [10, 10],
extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)',
},
grid: {
top: '20%',
},
xAxis: [
{
type: 'category',
data: xData,
axisLine: {
lineStyle: {
color: 'rgba(107,107,107,0.37)',
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
textStyle: {
color: '#999',
},
margin: 15,
},
axisPointer: {
label: {
padding: [11, 5, 7],
backgroundColor: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#fff',
},
{
offset: 0.9,
color: '#fff',
},
{
offset: 0.9,
color: '#33c0cd',
},
{
offset: 1,
color: '#33c0cd',
},
],
global: false,
},
},
},
boundaryGap: false,
},
],
yAxis: [
{
type: 'value',
show: false,
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: 'rgba(107,107,107,0.37)',
},
},
axisLabel: {
textStyle: {
color: '#999',
},
},
splitLine: {
show: false,
},
},
],
series: [
{
name: '蝗虫',
type: 'line',
data: [235, 852, 1208, 1988, 1657, 643],
symbolSize: 1,
symbol: 'circle',
smooth: true,
yAxisIndex: 0,
showSymbol: false,
lineStyle: {
width: 5,
color: '#3685FE',
shadowColor: 'rgba(158,135,255, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20,
},
itemStyle: {
color: colorList[0],
borderColor: colorList[0],
},
},
{
name: '飞蛾',
type: 'line',
data: [1124, 1055, 1654, 1764, 922, 55],
symbolSize: 1,
symbol: 'circle',
smooth: true,
yAxisIndex: 0,
showSymbol: false,
lineStyle: {
width: 5,
color: '#FFD500',
shadowColor: 'rgba(115,221,255, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20,
},
itemStyle: {
color: colorList[1],
borderColor: colorList[1],
},
},
{
name: '毛虫',
type: 'line',
data: [1245, 618, 1468, 1814, 2175],
symbolSize: 1,
symbol: 'circle',
smooth: true,
yAxisIndex: 0,
showSymbol: false,
lineStyle: {
width: 5,
color: '#25BF82',
shadowColor: 'rgba(115,221,255, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20,
},
itemStyle: {
color: colorList[2],
borderColor: colorList[2],
},
},
{
name: '其他昆虫',
type: 'line',
data: [1673, 1732, 783, 179, 963, 2068],
symbolSize: 1,
symbol: 'circle',
smooth: true,
yAxisIndex: 0,
showSymbol: false,
lineStyle: {
width: 5,
color: '#FE4066',
shadowColor: 'rgba(115,221,255, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20,
},
itemStyle: {
color: colorList[3],
borderColor: colorList[3],
},
},
],
};
const initChart = () => {
if (chartRef2.value) {
// domecharts
chartInstance = echarts.init(chartRef2.value);
//
chartInstance.setOption(option);
// tooltip
// showMaxValueTooltip();
//
window.addEventListener('resize', resizeChart);
setTimeout(() => chartInstance.resize(), 10);
}
};
//
onMounted(() => {
initChart();
});
//
onBeforeUnmount(() => {
if (chartInstance) {
window.removeEventListener('resize', resizeChart);
chartInstance.dispose();
chartInstance = null;
}
});
//
const resizeChart = () => {
if (chartInstance) {
chartInstance.resize();
}
};
</script>
<template>
<div style="width: 100%; min-height: 210px">
<div ref="chartRef2" style="width: 100%; height: 210px; margin-top: 20px"></div>
</div>
</template>
<style scoped lang="scss"></style>

View File

@ -5,6 +5,40 @@ import { useRoute, useRouter } from 'vue-router';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
// icon
const icons = [
{ 监控: 'camera' },
{ 传感器: 'sensor' },
{ 水质溶解氧: 'O2' },
{ 温度: 'temp' },
{ 酸碱度: 'ph' },
{ 水质电导率: 'elect' },
{ 浊度: 'dust' },
{ 悬浮物: 'float' },
{ 分光器: 'light' },
{ 阀门: 'valve' },
{ 喷头: 'sprinkler' },
{ 计时器: 'timer' },
{ 加热器: 'heater' },
{ 搅拌机: 'mixer' },
{ 热力: 'heat' },
{ 液位传感器: 'liquidSensor' },
{ 消毒灯: 'disinfectionLamp' },
{ 温度传感器: 'tempSensor' },
{ 智能阀控: 'intelligentValveControl' },
{ 供水阀: 'waterSupplyValve' },
{ 混合阀: 'mixingPump' },
{ 混合罐: 'mixingTank' },
{ 施肥: 'fertilization' },
{ 肥料罐: 'fertilizerTank' },
{ 电磁阀状态: 'solenoidValve' },
{ 'PM2.5': 'PM2.5' },
{ 风速仪: 'anemometer' },
{ 雨量计: 'rainGauge' },
{ 土壤传感器: 'soilSensor' },
{ 积水传感器: 'waterLoggingSensor' },
];
const props = defineProps({ const props = defineProps({
devices: { devices: {
type: Array, type: Array,
@ -54,6 +88,27 @@ const props = defineProps({
<img v-else-if="item.icon === 'dust'" :src="getAssetsFile('images/smartFarm/浊度.png')" alt="" /> <img v-else-if="item.icon === 'dust'" :src="getAssetsFile('images/smartFarm/浊度.png')" alt="" />
<img v-else-if="item.icon === 'float'" :src="getAssetsFile('images/smartFarm/悬浮物.png')" alt="" /> <img v-else-if="item.icon === 'float'" :src="getAssetsFile('images/smartFarm/悬浮物.png')" alt="" />
<img v-else-if="item.icon === 'light'" :src="getAssetsFile('images/smartFarm/分光器.png')" alt="" /> <img v-else-if="item.icon === 'light'" :src="getAssetsFile('images/smartFarm/分光器.png')" alt="" />
<img v-else-if="item.icon === 'valve'" :src="getAssetsFile('images/smartFarm/阀门.png')" alt="" />
<img v-else-if="item.icon === 'sprinkler'" :src="getAssetsFile('images/smartFarm/喷头.png')" alt="" />
<img v-else-if="item.icon === 'timer'" :src="getAssetsFile('images/smartFarm/计时器.png')" alt="" />
<img v-else-if="item.icon === 'heater'" :src="getAssetsFile('images/smartFarm/加热器.png')" alt="" />
<img v-else-if="item.icon === 'mixer'" :src="getAssetsFile('images/smartFarm/搅拌机.png')" alt="" />
<img v-else-if="item.icon === 'heat'" :src="getAssetsFile('images/smartFarm/热力.png')" alt="" />
<img v-else-if="item.icon === 'liquidSensor'" :src="getAssetsFile('images/smartFarm/液位传感器.png')" alt="" />
<img v-else-if="item.icon === 'disinfectionLamp'" :src="getAssetsFile('images/smartFarm/消毒灯.png')" alt="" />
<img v-else-if="item.icon === 'tempSensor'" :src="getAssetsFile('images/smartFarm/温度传感器.png')" alt="" />
<img v-else-if="item.icon === 'intelligentValveControl'" :src="getAssetsFile('images/smartFarm/智能阀控.png')" alt="" />
<img v-else-if="item.icon === 'waterSupplyValve'" :src="getAssetsFile('images/smartFarm/供水阀.png')" alt="" />
<img v-else-if="item.icon === 'mixingPump'" :src="getAssetsFile('images/smartFarm/混合泵.png')" alt="" />
<img v-else-if="item.icon === 'mixingTank'" :src="getAssetsFile('images/smartFarm/混合罐.png')" alt="" />
<img v-else-if="item.icon === 'fertilization'" :src="getAssetsFile('images/smartFarm/施肥.png')" alt="" />
<img v-else-if="item.icon === 'fertilizerTank'" :src="getAssetsFile('images/smartFarm/肥料罐.png')" alt="" />
<img v-else-if="item.icon === 'solenoidValve'" :src="getAssetsFile('images/smartFarm/电磁阀状态.png')" alt="" />
<img v-else-if="item.icon === 'PM2.5'" :src="getAssetsFile('images/smartFarm/PM2.5.png')" alt="" />
<img v-else-if="item.icon === 'anemometer'" :src="getAssetsFile('images/smartFarm/风速仪.png')" alt="" />
<img v-else-if="item.icon === 'rainGauge'" :src="getAssetsFile('images/smartFarm/雨量计.png')" alt="" />
<img v-else-if="item.icon === 'soilSensor'" :src="getAssetsFile('images/smartFarm/土壤传感器.png')" alt="" />
<img v-else-if="item.icon === 'waterLoggingSensor'" :src="getAssetsFile('images/smartFarm/积水传感器.png')" alt="" />
<div style="text-align: left; font-weight: bold; font-size: 18px">{{ item.name }}</div> <div style="text-align: left; font-weight: bold; font-size: 18px">{{ item.name }}</div>
</div> </div>
</div> </div>

View File

@ -56,23 +56,29 @@ const leftMenu = reactive([
isOpen: true, isOpen: true,
children: [ children: [
{ {
name: 'supplier', name: 'fieldInspection',
title: '田间监测', title: '田间监测',
icon: 'menu1.png', icon: 'menu1.png',
path: '/sub-operation-service/smartFarm/fieldInspection', path: '/sub-operation-service/smartFarm/fieldInspection',
}, },
{ {
name: 'supplier', name: 'waterInspection',
title: '水质监测', title: '水质监测',
icon: 'menu1.png', icon: 'menu1.png',
path: '/sub-operation-service/smartFarm/waterInspection', path: '/sub-operation-service/smartFarm/waterInspection',
}, },
{ {
name: 'supplier', name: 'bugInspection',
title: '病虫害监测', title: '病虫害监测',
icon: 'menu1.png', icon: 'menu1.png',
path: '/sub-operation-service/smartFarm/bugInspection', path: '/sub-operation-service/smartFarm/bugInspection',
}, },
{
name: 'envInspection',
title: '环境监测',
icon: 'menu1.png',
path: '/sub-operation-service/smartFarm/envInspection',
},
], ],
}, },
{ {

View File

@ -0,0 +1,124 @@
<template>
<div ref="chartRef" style="width: 100%; height: 230px"></div>
</template>
<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';
import * as echarts from 'echarts';
const chartRef = ref(null);
let chartInstance = null;
const initChart = () => {
if (!chartRef.value) return;
chartInstance = echarts.init(chartRef.value);
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
grid: {
left: '3%',
right: '4%',
bottom: '8%',
top: '15%',
containLabel: true,
},
legend: {
data: ['黑星病', '火疫病', '叶腐病'],
right: 10,
top: 10,
textStyle: {
color: '#000',
},
itemWidth: 12,
itemHeight: 10,
},
xAxis: {
type: 'category',
data: ['1月', '2月', '3月', '4月', '5月', '6月'],
axisLine: {
lineStyle: {
color: '#fff',
},
},
axisLabel: {
color: '#333',
fontSize: 12,
},
axisTick: {
alignWithLabel: true, // 线
lineStyle: {
color: 'rgba(255,255,255,0.3)', // 线
},
},
},
yAxis: {
type: 'value',
max: 1000,
axisLine: {
show: false,
},
axisLabel: {
show: false, // Y
},
splitLine: {
show: false, // 线
},
},
series: [
{
name: '黑星病',
type: 'bar',
barWidth: '15%',
itemStyle: {
borderRadius: 4,
color: '#3685FE', //
},
data: [400, 400, 300, 300, 300, 400],
},
{
name: '火疫病',
type: 'bar',
barWidth: '15%',
itemStyle: {
borderRadius: 4,
color: '#25BF82', // 绿
},
data: [400, 500, 500, 500, 500, 400],
},
{
name: '叶腐病',
type: 'bar',
barWidth: '15%',
itemStyle: {
borderRadius: 4,
color: '#FFD500', // 绿
},
data: [400, 600, 700, 700, 700, 400],
},
],
};
chartInstance.setOption(option);
//
const resizeChart = () => {
chartInstance?.resize();
};
window.addEventListener('resize', resizeChart);
onBeforeUnmount(() => {
window.removeEventListener('resize', resizeChart);
chartInstance?.dispose();
});
};
onMounted(() => {
initChart();
});
</script>

View File

@ -1,13 +1,227 @@
<script setup> <script setup>
import Devices from '@/views/smartFarm/components/devices.vue';
import Common from '@/views/smartFarm/components/common.vue';
import stream from '@/views/smartFarm/components/stream.vue';
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { getAssetsFile } from '@/utils/index.js';
import * as echarts from 'echarts';
import BugData from '@/views/smartFarm/components/bugData.vue';
import SickData from '@/views/smartFarm/components/sickData.vue';
const currentDevice = ref(0);
const devices = ref([
{
name: 'A-001',
icon: 'temp',
detail: 'A区-监控设备1',
status: '1',
id: 0,
},
{
name: 'A-002',
icon: 'temp',
detail: 'A区-监控设备2',
status: '1',
id: 1,
},
{
name: 'A-003',
icon: 'ph',
detail: 'A区-监控设备3',
status: '1',
id: 2,
},
{
name: 'A-004',
icon: 'ph',
detail: 'A区-监控设备4',
status: '-1',
id: 3,
},
{
name: 'A-005',
icon: 'O2',
detail: 'A区-监控设备5',
status: '1',
id: 4,
},
{
name: 'A-006',
icon: 'elect',
detail: 'A区-监控设备6',
status: '0',
id: 5,
},
{
name: 'B-001',
icon: 'light',
detail: 'B区-监控设备1',
status: '1',
id: 6,
},
{
name: 'B-002',
icon: 'elect',
detail: 'B区-监控设备2',
status: '-1',
id: 7,
},
{
name: 'B-003',
icon: 'dust',
detail: 'B区-监控设备3',
status: '1',
id: 8,
},
{
name: 'B-004',
icon: 'dust',
detail: 'B区-监控设备4',
status: '1',
id: 9,
},
{
name: 'B-005',
icon: 'float',
detail: 'B区-监控设备5',
status: '1',
id: 10,
},
{
name: 'B-006',
icon: 'float',
detail: 'B区-监控设备6',
status: '1',
id: 11,
},
]);
const rules = ref([
{
name: '温度',
icon: 'temp',
unit: '℃',
goat: '15',
status: '1',
},
{
name: 'PH值',
icon: 'ph',
unit: '',
goat: '6.5',
status: '1',
},
{
name: '溶解氧',
icon: 'O2',
goat: '0.4',
unit: 'mg/L',
status: '1',
},
{
name: '色度',
icon: 'light',
goat: '15',
unit: 'PCU',
status: '1',
},
{
name: '浊度',
icon: 'dust',
goat: '1.5',
unit: 'NTU',
status: '1',
},
{
name: '导电率',
icon: 'elect',
goat: '3000',
unit: 'μS/cm',
status: '1',
},
{
name: '悬浮物',
icon: 'float',
goat: '9000',
unit: 'mg/L',
status: '0',
},
]);
const isFullscreen = ref(false);
const toggleFullscreen = () => {
isFullscreen.value = !isFullscreen.value;
};
const chooseIcon = (type) => {
switch (type) {
case 'light':
return '分光器.png';
case 'float':
return '悬浮物.png';
case 'O2':
return '水质溶解氧.png';
case 'elect':
return '水质电导率.png';
case 'dust':
return '浊度.png';
case 'temp':
return '温度.png';
case 'ph':
return '酸碱度.png';
}
};
// #endregion
</script> </script>
<template> <template>
<div> <div>
<common>
<template #main>
<div>
<devices :title="'病虫害监测设备'" :devices="devices"></devices>
</div>
<div style="margin-top: 10px; display: flex; justify-content: space-between">
<div style="display: flex; justify-content: space-between; margin-top: 10px">
<stream :title="'病害监测实时监控'" :devices="devices" style="width: 60%; height: fit-content"></stream>
<div style="width: 38%">
<el-card style="border-radius: 16px; padding: 10px">
<div style="font-size: 16px; font-weight: bold; text-align: left; color: #000">虫害数据</div>
<sick-data style="width: 38%; min-width: 300px"></sick-data>
</el-card>
</div>
</div>
</div>
<div style="margin-top: 10px; display: flex; justify-content: space-between">
<div style="display: flex; justify-content: space-between; margin-top: 10px; width: 100%">
<stream :title="'虫害监测实时监控'" :devices="devices" style="width: 60%; height: fit-content"></stream>
<div style="width: 38%">
<el-card style="border-radius: 16px; padding: 10px">
<div style="font-size: 16px; font-weight: bold; text-align: left; color: #000">虫害数据</div>
<bug-data style="width: 38%; min-width: 300px"></bug-data>
</el-card>
</div>
</div>
</div>
</template>
</common>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.rates {
margin: 10px 0;
height: 100px;
font-size: 14px;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
background-size: 80%;
background-repeat: no-repeat;
background-position: center;
width: 25%;
img {
height: 20px;
}
}
</style> </style>

View File

@ -0,0 +1,285 @@
<template>
<div>
<common>
<template #main>
<div>
<devices :title="'环境监测设备'" :devices="devices"></devices>
</div>
<div style="margin-top: 10px; display: flex; justify-content: space-between">
<div style="display: flex; justify-content: space-between; margin-top: 10px; width: 100%">
<el-card style="width: 60%">
<div style="display: flex; justify-content: space-between">
<div style="font-size: 16px; font-weight: bold; text-align: left">实时环境监测</div>
<div style="color: #999999; line-height: 25px">
当前设备
<el-select v-model="currentDevice" placeholder="Select" size="small" style="width: 160px; margin-left: 10px">
<el-option v-for="item in devices" :key="item.value" :label="item.detail" :value="item.id" />
</el-select>
</div>
</div>
<div class="envData">
<div class="dt">
<div class="values">21</div>
<div class="points">空气温度</div>
</div>
<div class="dt">
<div class="values">61%</div>
<div class="points">空气湿度</div>
</div>
<div class="dt">
<div class="values">1600mm</div>
<div class="points">空气温度</div>
</div>
<div class="dt">
<div class="values">东南风</div>
<div class="points">风向</div>
</div>
</div>
<div class="envData">
<div class="dt">
<div class="values">12μg/</div>
<div class="points">PM2.5</div>
</div>
<div class="dt">
<div class="values">679Lux</div>
<div class="points">光照强度</div>
</div>
<div class="dt">
<div class="values">440ppm</div>
<div class="points">二氧化碳浓度</div>
</div>
<div class="dt">
<div class="values">1.5m/s</div>
<div class="points">风速</div>
</div>
</div>
<div class="notices">
<div v-for="(item, index) in notices" :key="index">
<img :src="getAssetsFile('images/smartFarm/bell.png')" alt="" style="height: 20px" />
<span style="font-size: 14px">{{ item.title }}</span>
</div>
</div>
</el-card>
<el-card style="width: calc(40% - 20px); border-radius: 16px; padding: 10px">
<div style="font-size: 16px; font-weight: bold; text-align: left">作物生长状态</div>
<div class="plantStatus">
<div class="leftKey">酸碱度:</div>
<div class="rightValue">6.5 正常</div>
</div>
<div class="plantStatus">
<div class="leftKey">养分含量:</div>
<div class="errorValue">N 元素含量不足</div>
</div>
<div class="plantStatus">
<div class="leftKey">重金属含量:</div>
<div class="errorValue">Hg 金属含量超标</div>
</div>
<div class="plantStatus">
<div class="leftKey">水温:</div>
<div class="errorValue">38 偏高</div>
</div>
<div class="plantStatus">
<div class="leftKey">水浑浊度:</div>
<div class="rightValue">良好</div>
</div>
<div class="plantStatus">
<div class="leftKey">酸碱度:</div>
<div class="rightValue">正常</div>
</div>
<div class="plantStatus">
<div class="leftKey">盐分含量:</div>
<div class="rightValue">正常</div>
</div>
</el-card>
</div>
</div>
</template>
</common>
</div>
</template>
<script setup>
import { ref } from 'vue';
import Devices from '@/views/smartFarm/components/devices.vue';
import Common from '@/views/smartFarm/components/common.vue';
import { getAssetsFile } from '@/utils/index.js';
/* --------------- data --------------- */
// #region
const devices = ref([
{
name: 'A-001',
icon: 'temp',
detail: 'A区-监控设备1',
status: '1',
id: 0,
},
{
name: 'A-002',
icon: 'temp',
detail: 'A区-监控设备2',
status: '1',
id: 1,
},
{
name: 'A-003',
icon: 'temp',
detail: 'A区-监控设备3',
status: '1',
id: 2,
},
{
name: 'A-004',
icon: 'soilSensor',
detail: 'A区-监控设备4',
status: '-1',
id: 3,
},
{
name: 'A-005',
icon: 'anemometer',
detail: 'A区-监控设备5',
status: '1',
id: 4,
},
{
name: 'A-006',
icon: 'anemometer',
detail: 'A区-监控设备6',
status: '0',
id: 5,
},
{
name: 'B-001',
icon: 'rainGauge',
detail: 'B区-监控设备1',
status: '1',
id: 6,
},
{
name: 'B-002',
icon: 'rainGauge',
detail: 'B区-监控设备2',
status: '-1',
id: 7,
},
{
name: 'B-003',
icon: 'waterLoggingSensor',
detail: 'B区-监控设备3',
status: '1',
id: 8,
},
{
name: 'B-004',
icon: 'PM2.5',
detail: 'B区-监控设备4',
status: '1',
id: 9,
},
{
name: 'B-005',
icon: 'PM2.5',
detail: 'B区-监控设备5',
status: '1',
id: 10,
},
{
name: 'B-006',
icon: 'light',
detail: 'B区-监控设备6',
status: '1',
id: 11,
},
]);
const currentDevice = ref(0);
const notices = ref([
{
title: '2025年1月1日预计将会有特大暴雨请提前做好防护措施',
content: '',
},
{
title: '2025年1月1日预计将会有特大暴雨请提前做好防护措施',
content: '',
},
]);
// #endregion
/* --------------- methods --------------- */
// #region
const chooseIcon = (type) => {
switch (type) {
case 'light':
return '分光器.png';
case 'float':
return '悬浮物.png';
case 'O2':
return '水质溶解氧.png';
case 'elect':
return '水质电导率.png';
case 'dust':
return '浊度.png';
case 'temp':
return '温度.png';
case 'ph':
return '酸碱度.png';
}
};
// #endregion
</script>
<style lang="scss" scoped>
.plantStatus {
display: flex;
justify-content: space-between;
font-size: 14px;
margin: 7px 0;
.leftKey {
color: #000000;
}
.rightValue {
color: #25bf82;
}
.errorValue {
color: #fe4066;
}
}
.notices {
div {
margin: 10px 0;
}
text-align: left;
}
.envData {
display: flex;
justify-content: space-between;
margin: 20px 0;
.dt {
width: 24%;
text-align: left;
.values {
color: #25bf82;
font-size: 20px;
font-weight: bold;
}
.points {
color: #999999;
font-size: 14px;
}
}
}
.plantStatus {
display: flex;
justify-content: space-between;
font-size: 14px;
margin: 10px 0;
.leftKey {
color: #000000;
}
.rightValue {
color: #25bf82;
}
}
</style>