|
|
@@ -109,7 +109,6 @@
|
|
|
<div v-if="!displayTaskList.length" class="empty-tip">{{ t("workExecute.noData") }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <farm-calendar-popup v-model:show="showFarmCalendarPopup" @confirm="goCompleteFarmInfo" />
|
|
|
<survey-ask-popup v-model:show="showSurveyAskPopup" @confirm="handleSurveyConfirm" />
|
|
|
|
|
|
<!-- 诊断报告弹窗:组件内接口判断 exists=2 且本地未展示过 -->
|
|
|
@@ -121,19 +120,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed, nextTick, onActivated, onDeactivated, onMounted, ref } from "vue";
|
|
|
+import { computed, nextTick, onActivated, ref } from "vue";
|
|
|
import { useStore } from "vuex";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import IndexMap from "./index";
|
|
|
import customCalendar from "./components/calendar.vue";
|
|
|
import farmHeader from "@/components/farmHeader.vue";
|
|
|
-import farmCalendarPopup from "@/components/popup/farmCalendarPopup.vue";
|
|
|
import surveyAskPopup from "@/components/popup/surveyAskPopup.vue";
|
|
|
import diagnosisReportPopup from "@/components/popup/diagnosisReportPopup.vue";
|
|
|
import restorePlantingPopup from "@/components/popup/restorePlantingPopup.vue";
|
|
|
import { useI18n } from "@/i18n";
|
|
|
import { saveSelectedFarm } from "@/utils/selectedFarm";
|
|
|
+import { loadFarmList } from "@/utils/farmPresence";
|
|
|
import wx from "weixin-js-sdk";
|
|
|
import { Icon } from 'vant';
|
|
|
|
|
|
@@ -157,7 +156,6 @@ const router = useRouter();
|
|
|
const indexMap = new IndexMap();
|
|
|
const mapContainer = ref(null);
|
|
|
const calendarRef = ref(null);
|
|
|
-const showFarmCalendarPopup = ref(false);
|
|
|
/** 调查问卷弹窗:后续由接口决定是否展示 */
|
|
|
const showSurveyAskPopup = ref(false);
|
|
|
const tabBarHeight = computed(() => store.state.home.tabBarHeight);
|
|
|
@@ -419,31 +417,14 @@ const syncCalendar = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-/** 无果园信息时展示「完善农场信息 / 专属农事日历」弹窗 */
|
|
|
-async function checkFarmCalendarPopup() {
|
|
|
- const id = getMiniUserId();
|
|
|
- if (!id) {
|
|
|
- showFarmCalendarPopup.value = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- try {
|
|
|
- const res = await VE_API.questionnaire.getFarms({ id });
|
|
|
- const list = Array.isArray(res?.data) ? res.data : [];
|
|
|
- showFarmCalendarPopup.value = list.length === 0;
|
|
|
- } catch (e) {
|
|
|
- console.warn("[work_execute] getFarms failed", e);
|
|
|
- showFarmCalendarPopup.value = false;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
/** 无选中农场时写入列表首项,保证 zone_fw_task_list 有 farm_id */
|
|
|
async function ensureSelectedFarm() {
|
|
|
if (getSelectedFarmId() != null) return true;
|
|
|
const id = getMiniUserId();
|
|
|
if (!id) return false;
|
|
|
try {
|
|
|
- const res = await VE_API.questionnaire.getFarms({ id });
|
|
|
- const list = Array.isArray(res?.data) ? res.data : [];
|
|
|
+ const list = await loadFarmList();
|
|
|
+ if (!Array.isArray(list)) return false;
|
|
|
return list[0] ? saveSelectedFarm(list[0]) : false;
|
|
|
} catch (e) {
|
|
|
console.warn("[work_execute] ensureSelectedFarm failed", e);
|
|
|
@@ -633,10 +614,6 @@ const handleMarkComplete = async (item) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const goCompleteFarmInfo = () => {
|
|
|
- router.push("/entry_information");
|
|
|
-};
|
|
|
-
|
|
|
const handleSurveyConfirm = () => {
|
|
|
showSurveyAskPopup.value = false;
|
|
|
router.push("/survey_entry");
|
|
|
@@ -676,7 +653,7 @@ const refreshPage = async () => {
|
|
|
pageLoading.value = true;
|
|
|
try {
|
|
|
await ensureSelectedFarm();
|
|
|
- // 无农场时不打任务列表(弹窗由 checkFarmCalendarPopup 负责)
|
|
|
+ // 无农场时不打任务列表(无农场弹窗由应用层 noFarmPopupHost 负责)
|
|
|
if (getSelectedFarmId() == null) {
|
|
|
taskList.value = [];
|
|
|
zoneList.value = [];
|
|
|
@@ -708,18 +685,9 @@ const refreshPage = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- // checkFarmCalendarPopup();
|
|
|
- // nextTick(refreshPage);
|
|
|
-});
|
|
|
-
|
|
|
onActivated(() => {
|
|
|
- checkFarmCalendarPopup();
|
|
|
nextTick(refreshPage);
|
|
|
});
|
|
|
-onDeactivated(() => {
|
|
|
- showFarmCalendarPopup.value = false;
|
|
|
-});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|