|
|
@@ -11,7 +11,7 @@
|
|
|
<div class="archives-time-line-header">
|
|
|
<div class="line-title" @click="handlePage">作物档案</div>
|
|
|
<div class="header-right">
|
|
|
- <div class="add-variety-btn" @click="handleAddVariety">
|
|
|
+ <div class="add-variety-btn" v-if="varietyTabs.length > 0" @click="handleAddVariety">
|
|
|
<el-icon size="12">
|
|
|
<Plus />
|
|
|
</el-icon>
|
|
|
@@ -64,8 +64,9 @@
|
|
|
sub-title="精准匹配农情信息,高效管理分区" @confirm="handleGoSelectRegion" @skip="handleSkipSelectRegion" />
|
|
|
|
|
|
<!-- 农事执行弹窗 -->
|
|
|
- <agri-execute-popup v-model:show="showAgriExecutePopup" :popupData="agriExecuteData" @executed="handleAgriExecuted"
|
|
|
- @close="handleClosePopup" />
|
|
|
+ <agri-execute-popup ref="agriExecutePopupRef" />
|
|
|
+
|
|
|
+ <start-interact-popup ref="startInteractPopupRef" />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
@@ -79,11 +80,16 @@ import selectRegionPopup from "@/components/popup/selectRegionPopup.vue";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import ArchivesFarmTimeLine from "@/components/pageComponents/ArchivesFarmTimeLine.vue";
|
|
|
import agriExecutePopup from "@/components/popup/agriExecutePopup.vue";
|
|
|
+import startInteractPopup from "@/components/popup/startInteractPopup.vue";
|
|
|
|
|
|
+const startInteractPopupRef = ref(null);
|
|
|
const handlePage = () => {
|
|
|
router.push("/interaction_list");
|
|
|
}
|
|
|
|
|
|
+const agriExecutePopupRef = ref(null);
|
|
|
+
|
|
|
+
|
|
|
// 品种选择(作物档案内)- 根据主体ID动态获取分区列表
|
|
|
const varietyTabs = ref([]);
|
|
|
const activeVariety = ref(0);
|
|
|
@@ -132,31 +138,6 @@ const handleGoSelectRegion = () => {
|
|
|
router.push("/draw_area");
|
|
|
};
|
|
|
|
|
|
-const showAgriExecutePopup = ref(false); // 农事执行弹窗
|
|
|
-const agriExecuteData = ref({});
|
|
|
-const handleAgriExecuted = () => {
|
|
|
- showAgriExecutePopup.value = false;
|
|
|
- handleClosePopup();
|
|
|
- router.push(`/interaction_list?farmId=${farmIdData.value}®ionId=${regionData.value}&interactionTypeId=${expertInfo.value.interactionTypeId}`);
|
|
|
-};
|
|
|
-
|
|
|
-const expertInfo = ref({});
|
|
|
-const checkHasUnrepliedTriggeredInteraction = async () => {
|
|
|
- const { data } = await VE_API.home.hasUnrepliedTriggeredInteraction({ subjectId: gardenId.value });
|
|
|
- if (data && data.id != null) {
|
|
|
- expertInfo.value = data;
|
|
|
- agriExecuteData.value = {
|
|
|
- expertAvatar: data.expertAvatar,
|
|
|
- expertName: data.expertName,
|
|
|
- title: data.subjectName,
|
|
|
- abnormalText: data.subjectRemark,
|
|
|
- exampleImg: JSON.parse(data.exampleImagesJson)[0],
|
|
|
- executedButtonText: '开始采集',
|
|
|
- };
|
|
|
- showAgriExecutePopup.value = true;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
const showFarmPopup = ref(false); // 农场领取成功弹窗
|
|
|
|
|
|
const defaultGardenId = ref(null);
|
|
|
@@ -194,53 +175,8 @@ const handleLockClick = () => {
|
|
|
|
|
|
// 实时播报数据
|
|
|
const broadcastList = ref([]);
|
|
|
-const loading = ref(false);
|
|
|
const finished = ref(false);
|
|
|
const currentPage = ref(1);
|
|
|
-const pageSize = ref(10);
|
|
|
-
|
|
|
-const getBroadcastList = async (page = 1, isLoadMore = false) => {
|
|
|
- if (!gardenId.value) {
|
|
|
- loading.value = false;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 如果正在加载,直接返回(避免重复请求)
|
|
|
- if (loading.value) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- loading.value = true;
|
|
|
- try {
|
|
|
- const res = await VE_API.monitor.broadcastPage({
|
|
|
- farmId: gardenId.value,
|
|
|
- limit: pageSize.value,
|
|
|
- page: page,
|
|
|
- });
|
|
|
-
|
|
|
- const newData = res.data || [];
|
|
|
- if (isLoadMore) {
|
|
|
- broadcastList.value = [...broadcastList.value, ...newData];
|
|
|
- } else {
|
|
|
- broadcastList.value = newData;
|
|
|
- }
|
|
|
-
|
|
|
- // 判断是否还有更多数据
|
|
|
- if (newData.length < pageSize.value) {
|
|
|
- finished.value = true;
|
|
|
- } else {
|
|
|
- finished.value = false;
|
|
|
- // 如果未完成,页码+1,为下次加载做准备
|
|
|
- currentPage.value = page + 1;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error("获取播报列表失败:", error);
|
|
|
- finished.value = true;
|
|
|
- } finally {
|
|
|
- // 确保 loading 状态被正确设置为 false
|
|
|
- loading.value = false;
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
// 播报相关事件
|
|
|
const isSpeaking = ref(false);
|
|
|
@@ -289,10 +225,13 @@ const changeGarden = ({ id }) => {
|
|
|
currentPage.value = 1;
|
|
|
finished.value = false;
|
|
|
broadcastList.value = [];
|
|
|
- getBroadcastList(1, false);
|
|
|
- checkHasUnrepliedTriggeredInteraction();
|
|
|
getReport();
|
|
|
getVarietyTabs();
|
|
|
+
|
|
|
+ if(varietyTabs.value.length) {
|
|
|
+ agriExecutePopupRef.value.showPopup(varietyTabs.value[activeVariety.value].farmId);
|
|
|
+ }
|
|
|
+ startInteractPopupRef.value.getPhenologyInitOrConfirmStatus();
|
|
|
};
|
|
|
|
|
|
function handleReportClick() {
|
|
|
@@ -302,12 +241,6 @@ function handleReportClick() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-const handleClosePopup = () => {
|
|
|
- VE_API.monitor.closeTodayPopup({
|
|
|
- interactionId: expertInfo.value.id,
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
const getReport = () => {
|
|
|
VE_API.farm.growthReportBySubject({ subjectId: gardenId.value, limit: 20 }).then(({ data }) => {
|
|
|
if (data && data.length > 0) {
|