|
@@ -67,19 +67,23 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div v-else>
|
|
<div v-else>
|
|
|
- <div class="situation-card__head" v-for="item in situationList" :key="item.nameKey">
|
|
|
|
|
|
|
+ <div class="situation-card__head" v-for="item in situationList" :key="item.id">
|
|
|
<div class="situation-card__name">
|
|
<div class="situation-card__name">
|
|
|
<img class="situation-card__icon" src="@/assets/img/agricultural/gaojin.png" alt="" />
|
|
<img class="situation-card__icon" src="@/assets/img/agricultural/gaojin.png" alt="" />
|
|
|
- <span>{{ t(item.nameKey) }}</span>
|
|
|
|
|
|
|
+ <span>{{ item.abnormal_type }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="situation-card__assess">
|
|
<div class="situation-card__assess">
|
|
|
<div class="situation-card__assess-title">{{ t("agriFile.agriAssessment") }}</div>
|
|
<div class="situation-card__assess-title">{{ t("agriFile.agriAssessment") }}</div>
|
|
|
- <div class="situation-card__assess-desc">{{ t("agriFile.agriAssessmentDesc") }}</div>
|
|
|
|
|
|
|
+ <div class="situation-card__assess-desc">{{ item.interaction_reason }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="situation-card__guide">
|
|
<div class="situation-card__guide">
|
|
|
<div class="guide-title">{{ t("agriFile.patrolGuide") }}</div>
|
|
<div class="guide-title">{{ t("agriFile.patrolGuide") }}</div>
|
|
|
- <div class="situation-card__guide-box">
|
|
|
|
|
- <img src="@/assets/img/agricultural/patrol-guide.png" alt="" />
|
|
|
|
|
|
|
+ <div v-if="item.guideImg" class="situation-card__guide-box">
|
|
|
|
|
+ <photo-provider :photo-closable="true">
|
|
|
|
|
+ <photo-consumer :src="item.guideImg">
|
|
|
|
|
+ <img :src="item.guideImg" alt="" />
|
|
|
|
|
+ </photo-consumer>
|
|
|
|
|
+ </photo-provider>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -156,10 +160,8 @@ const selectedOptionId = ref(null);
|
|
|
const showUploadPopup = ref(false);
|
|
const showUploadPopup = ref(false);
|
|
|
const showSuccessPopup = ref(false);
|
|
const showSuccessPopup = ref(false);
|
|
|
const showLeavePopup = ref(false);
|
|
const showLeavePopup = ref(false);
|
|
|
-const situationList = [
|
|
|
|
|
- { nameKey: "agriFile.growthAbnormal" },
|
|
|
|
|
- { nameKey: "agriFile.rootAbnormal" },
|
|
|
|
|
-];
|
|
|
|
|
|
|
+/** 异常态势列表:parse_anormal.anormal_list */
|
|
|
|
|
+const situationList = ref([]);
|
|
|
|
|
|
|
|
/** 作物档案本地记录(提交互动后写入,农事档案页读取) */
|
|
/** 作物档案本地记录(提交互动后写入,农事档案页读取) */
|
|
|
const CROP_ARCHIVE_KEY = "CROP_ARCHIVE_RECORDS";
|
|
const CROP_ARCHIVE_KEY = "CROP_ARCHIVE_RECORDS";
|
|
@@ -173,6 +175,14 @@ function readEntryFarmData() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const interactImg = ref("");
|
|
const interactImg = ref("");
|
|
|
|
|
+
|
|
|
|
|
+function resolveGuideImg(item) {
|
|
|
|
|
+ const raw = item?.interact_pic_url || item?.pic_url || item?.image_url || item?.guide_img || "";
|
|
|
|
|
+ if (!raw || typeof raw !== "string") return "";
|
|
|
|
|
+ if (/^https?:\/\//i.test(raw) || raw.startsWith("data:")) return raw;
|
|
|
|
|
+ return `${base_img_url2}${raw}`;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function applyInteractData(data) {
|
|
function applyInteractData(data) {
|
|
|
if (!data) return;
|
|
if (!data) return;
|
|
|
theme.value = data.interaction_title || "";
|
|
theme.value = data.interaction_title || "";
|
|
@@ -189,6 +199,25 @@ function applyInteractData(data) {
|
|
|
selectedOptionId.value = null;
|
|
selectedOptionId.value = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 异常态势:parse_anormal */
|
|
|
|
|
+function applyAbnormalData(data) {
|
|
|
|
|
+ if (!data) return;
|
|
|
|
|
+ theme.value = data.interaction_title || "";
|
|
|
|
|
+ reason.value = data.interaction_theme || "";
|
|
|
|
|
+ zoneName.value = data.crop_category_name || "";
|
|
|
|
|
+ const list = Array.isArray(data.anormal_list)
|
|
|
|
|
+ ? data.anormal_list
|
|
|
|
|
+ : Array.isArray(data.abnormal_list)
|
|
|
|
|
+ ? data.abnormal_list
|
|
|
|
|
+ : [];
|
|
|
|
|
+ situationList.value = list.map((item, index) => ({
|
|
|
|
|
+ id: item?.id ?? index,
|
|
|
|
|
+ abnormal_type: item?.abnormal_type || "",
|
|
|
|
|
+ interaction_reason: item?.interaction_reason || "",
|
|
|
|
|
+ guideImg: resolveGuideImg(item),
|
|
|
|
|
+ }));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/** 长势跟踪:parse_interact */
|
|
/** 长势跟踪:parse_interact */
|
|
|
async function fetchGrowthInteract() {
|
|
async function fetchGrowthInteract() {
|
|
|
if (isAbnormal.value) return;
|
|
if (isAbnormal.value) return;
|
|
@@ -212,6 +241,29 @@ async function fetchGrowthInteract() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 异常态势详情:parse_anormal */
|
|
|
|
|
+async function fetchAbnormalInteract() {
|
|
|
|
|
+ if (!isAbnormal.value) return;
|
|
|
|
|
+ const entry = readEntryFarmData();
|
|
|
|
|
+ const cropCategoryName = entry?.crop;
|
|
|
|
|
+ const phenophaseCode = entry?.cropCode;
|
|
|
|
|
+ const riskName = entry?.weatherStress || entry?.weatherRisk;
|
|
|
|
|
+ if (!cropCategoryName || !phenophaseCode || !riskName) return;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await VE_API.questionnaire.abnormalContent({
|
|
|
|
|
+ crop_category_name: cropCategoryName,
|
|
|
|
|
+ phenophase_code: String(phenophaseCode),
|
|
|
|
|
+ risk_name: riskName,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res?.code === 200 && res.data) {
|
|
|
|
|
+ applyAbnormalData(res.data);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ // ignore
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function formatToday() {
|
|
function formatToday() {
|
|
|
const now = new Date();
|
|
const now = new Date();
|
|
|
const y = now.getFullYear();
|
|
const y = now.getFullYear();
|
|
@@ -280,11 +332,19 @@ const confirmLeave = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- fetchGrowthInteract();
|
|
|
|
|
|
|
+ if (isAbnormal.value) {
|
|
|
|
|
+ fetchAbnormalInteract();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fetchGrowthInteract();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
|
- if (!isAbnormal.value) fetchGrowthInteract();
|
|
|
|
|
|
|
+ if (isAbnormal.value) {
|
|
|
|
|
+ fetchAbnormalInteract();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fetchGrowthInteract();
|
|
|
|
|
+ }
|
|
|
if (route.query.showUpload !== "1") return;
|
|
if (route.query.showUpload !== "1") return;
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
showUploadPopup.value = true;
|
|
showUploadPopup.value = true;
|