|
@@ -6,8 +6,8 @@
|
|
|
<weather-info ref="weatherInfoRef" class="weather-info" @weatherExpanded="weatherExpanded"
|
|
<weather-info ref="weatherInfoRef" class="weather-info" @weatherExpanded="weatherExpanded"
|
|
|
@changeGarden="changeGarden" :isGarden="true"></weather-info>
|
|
@changeGarden="changeGarden" :isGarden="true"></weather-info>
|
|
|
<div class="report-content-wrap" v-if="hasReport" v-loading="loading">
|
|
<div class="report-content-wrap" v-if="hasReport" v-loading="loading">
|
|
|
- <swipe class="my-swipe" :loop="false" indicator-color="white">
|
|
|
|
|
- <swipe-item v-for="(item, index) in 4" :key="index">
|
|
|
|
|
|
|
+ <swipe class="my-swipe" :loop="false" indicator-color="white" @change="handleSwipeChange">
|
|
|
|
|
+ <swipe-item v-for="(item, index) in regionsData" :key="index">
|
|
|
<div class="report-content has-report">
|
|
<div class="report-content has-report">
|
|
|
<!-- <img src="@/assets/img/home/qrcode.png" alt="" class="code-icon" /> -->
|
|
<!-- <img src="@/assets/img/home/qrcode.png" alt="" class="code-icon" /> -->
|
|
|
<img class="header-img" src="@/assets/img/home/report.png" alt="" />
|
|
<img class="header-img" src="@/assets/img/home/report.png" alt="" />
|
|
@@ -31,17 +31,20 @@
|
|
|
<div class="report-box">
|
|
<div class="report-box">
|
|
|
<div class="box-title warning">今日巡园重点</div>
|
|
<div class="box-title warning">今日巡园重点</div>
|
|
|
<div class="box-text w-100">
|
|
<div class="box-text w-100">
|
|
|
- <div class="row" v-for="row in todayRows" :key="row.label">
|
|
|
|
|
- <div v-for="card in row.cards" :key="card.id" class="status-card" :class="card.type"
|
|
|
|
|
- @click="handleBlockClick(card, row.label)">
|
|
|
|
|
- <badge class="status-badge" dot v-if="card.title === '冲楸异常'"
|
|
|
|
|
|
|
+ <div class="row">
|
|
|
|
|
+ <div v-for="(card, cardI) in todayPatrolFocus" :key="cardI" class="status-card" :class="card.type"
|
|
|
|
|
+ >
|
|
|
|
|
+ <badge class="status-badge" dot
|
|
|
:offset="[80, -10]">
|
|
:offset="[80, -10]">
|
|
|
</badge>
|
|
</badge>
|
|
|
<div class="status-title">
|
|
<div class="status-title">
|
|
|
- {{ card.title }}
|
|
|
|
|
|
|
+ {{ card.typeName }}
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="status-sub" v-if="card.sub">
|
|
|
|
|
- {{ card.sub }}
|
|
|
|
|
|
|
+ <div class="status-sub" v-if="card.source === 'NEXT_PHENOLOGY'">
|
|
|
|
|
+ 预计{{card.daysUntilNext}}天后进入
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="status-sub" v-else>
|
|
|
|
|
+ {{ card.description }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -51,17 +54,17 @@
|
|
|
<div class="report-box">
|
|
<div class="report-box">
|
|
|
<div class="box-title warning">待执行农事</div>
|
|
<div class="box-title warning">待执行农事</div>
|
|
|
<div class="box-text w-100">
|
|
<div class="box-text w-100">
|
|
|
- <div class="row" v-for="row in todoRows" :key="row.label">
|
|
|
|
|
- <div v-for="card in row.cards" :key="card.id" class="status-card" :class="card.type"
|
|
|
|
|
- @click="handleBlockClick(card, row.label)">
|
|
|
|
|
- <badge class="status-badge" dot v-if="card.title === '冲楸异常'"
|
|
|
|
|
|
|
+ <div class="row">
|
|
|
|
|
+ <div v-for="(card, cardI) in pendingFarmWork" :key="cardI" class="status-card" :class="card.type"
|
|
|
|
|
+ >
|
|
|
|
|
+ <badge class="status-badge" dot
|
|
|
:offset="[80, -10]">
|
|
:offset="[80, -10]">
|
|
|
</badge>
|
|
</badge>
|
|
|
<div class="status-title">
|
|
<div class="status-title">
|
|
|
- {{ card.title }}
|
|
|
|
|
|
|
+ {{ card.name }}
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="status-sub" v-if="card.sub">
|
|
|
|
|
- {{ card.sub }}
|
|
|
|
|
|
|
+ <div class="status-sub">
|
|
|
|
|
+ {{ card.status }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -292,7 +295,7 @@ const changeGarden = ({ id }) => {
|
|
|
...(paramsPage.value || {}),
|
|
...(paramsPage.value || {}),
|
|
|
farmId: id,
|
|
farmId: id,
|
|
|
};
|
|
};
|
|
|
- getDetail();
|
|
|
|
|
|
|
+ getRegions();
|
|
|
const guideKey = "GROWTH_REPORT_SWIPE_GUIDE_SHOWN";
|
|
const guideKey = "GROWTH_REPORT_SWIPE_GUIDE_SHOWN";
|
|
|
if (!localStorage.getItem(guideKey)) {
|
|
if (!localStorage.getItem(guideKey)) {
|
|
|
showSwipeGuide.value = true;
|
|
showSwipeGuide.value = true;
|
|
@@ -342,6 +345,33 @@ const setReadStatus = (id) => {
|
|
|
console.log(data);
|
|
console.log(data);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+const todayPatrolFocus = ref([]);
|
|
|
|
|
+const pendingFarmWork = ref([]);
|
|
|
|
|
+const getTodayPatrolFocus = () => {
|
|
|
|
|
+ VE_API.report.todayPatrolFocus({ farmId: paramsPage.value.regionId }).then(({ data }) => {
|
|
|
|
|
+ todayPatrolFocus.value = data || [];
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const getPendingFarmWork = () => {
|
|
|
|
|
+ VE_API.report.pendingFarmWork({ farmId: paramsPage.value.regionId }).then(({ data }) => {
|
|
|
|
|
+ pendingFarmWork.value = data || [];
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleSwipeChange = (index) => {
|
|
|
|
|
+ if (paramsPage.value.regionId !== regionsData.value[index].farmId) {
|
|
|
|
|
+ paramsPage.value = {
|
|
|
|
|
+ ...(paramsPage.value || {}),
|
|
|
|
|
+ regionId: regionsData.value[index].farmId,
|
|
|
|
|
+ };
|
|
|
|
|
+ getTodayPatrolFocus();
|
|
|
|
|
+ getPendingFarmWork();
|
|
|
|
|
+ getDetail();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const getDetail = () => {
|
|
const getDetail = () => {
|
|
|
if (!paramsPage.value.farmId) return;
|
|
if (!paramsPage.value.farmId) return;
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
@@ -349,15 +379,36 @@ const getDetail = () => {
|
|
|
.growthReportBySubject({ subjectId: paramsPage.value.farmId, limit: 20 })
|
|
.growthReportBySubject({ subjectId: paramsPage.value.farmId, limit: 20 })
|
|
|
.then(({ data }) => {
|
|
.then(({ data }) => {
|
|
|
console.log('data', data);
|
|
console.log('data', data);
|
|
|
- // workItem.value = data?.[0] || {};
|
|
|
|
|
|
|
+ workItem.value = data?.[0] || {};
|
|
|
data?.[0]?.id && setReadStatus(data[0]?.id);
|
|
data?.[0]?.id && setReadStatus(data[0]?.id);
|
|
|
- // hasReport.value = data && data.length > 0;
|
|
|
|
|
})
|
|
})
|
|
|
.finally(() => {
|
|
.finally(() => {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const regionsData = ref([]);
|
|
|
|
|
+const getRegions = async () => {
|
|
|
|
|
+ VE_API.monitor.listRegionsBySubjectId({
|
|
|
|
|
+ subjectId: paramsPage.value.farmId,
|
|
|
|
|
+ }).then(({ data }) => {
|
|
|
|
|
+ console.log('getRegions', data);
|
|
|
|
|
+ regionsData.value = data || [];
|
|
|
|
|
+ if(regionsData.value.length > 0) {
|
|
|
|
|
+ hasReport.value = true;
|
|
|
|
|
+ paramsPage.value = {
|
|
|
|
|
+ ...(paramsPage.value || {}),
|
|
|
|
|
+ regionId: regionsData.value[0].farmId,
|
|
|
|
|
+ };
|
|
|
|
|
+ getTodayPatrolFocus();
|
|
|
|
|
+ getPendingFarmWork();
|
|
|
|
|
+ getDetail();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ hasReport.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 清理数据的函数
|
|
// 清理数据的函数
|
|
|
const clearData = () => {
|
|
const clearData = () => {
|
|
|
workItem.value = {};
|
|
workItem.value = {};
|