|
@@ -12,7 +12,8 @@
|
|
|
:isGoBack="false"
|
|
:isGoBack="false"
|
|
|
/>
|
|
/>
|
|
|
<div class="page-content">
|
|
<div class="page-content">
|
|
|
- <div v-if="reportGenerating" class="report-progress">
|
|
|
|
|
|
|
+ <!-- 无分区且生成中:整页进度(如无农场按定位生成) -->
|
|
|
|
|
+ <div v-if="reportGenerating && !zoneList.length" class="report-progress">
|
|
|
<div class="report-progress__content">
|
|
<div class="report-progress__content">
|
|
|
<div>
|
|
<div>
|
|
|
<el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
|
|
<el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
|
|
@@ -24,6 +25,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 有分区时生成中也保留头部与分区切换;进度条显示在下方 -->
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
<div class="diagnosis-header">
|
|
<div class="diagnosis-header">
|
|
|
<div class="header-share" @click="handleShare">
|
|
<div class="header-share" @click="handleShare">
|
|
@@ -41,7 +43,7 @@
|
|
|
<!-- <div class="diagnosis-header__base">{{ headerBase }}</div> -->
|
|
<!-- <div class="diagnosis-header__base">{{ headerBase }}</div> -->
|
|
|
</div>
|
|
</div>
|
|
|
<div class="diagnosis-content">
|
|
<div class="diagnosis-content">
|
|
|
- <div class="variety-bar">
|
|
|
|
|
|
|
+ <div v-if="zoneList.length" class="variety-bar">
|
|
|
<div class="variety-bar__tags">
|
|
<div class="variety-bar__tags">
|
|
|
<div
|
|
<div
|
|
|
v-for="item in zoneList"
|
|
v-for="item in zoneList"
|
|
@@ -60,85 +62,102 @@
|
|
|
<span>新增品种</span>
|
|
<span>新增品种</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="base-data">
|
|
|
|
|
- <!-- <div class="base-data__title">
|
|
|
|
|
- <span class="title-dot"></span>
|
|
|
|
|
- <span>基本信息</span>
|
|
|
|
|
- </div> -->
|
|
|
|
|
- <div class="base-data__body">
|
|
|
|
|
- <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
|
|
|
|
|
- <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
|
|
|
|
|
- <div class="base-info-item__row">
|
|
|
|
|
- <span class="base-info-item__label">{{ item.label }}</span>
|
|
|
|
|
- <span class="base-info-item__value">{{ item.value }}</span>
|
|
|
|
|
- <!-- <span v-if="item.actionInline" class="base-info-action"
|
|
|
|
|
- @click="handleBaseAction(item.actionInline.key)">
|
|
|
|
|
- {{ item.actionInline.text }}
|
|
|
|
|
- <el-icon><Edit /></el-icon>
|
|
|
|
|
- </span> -->
|
|
|
|
|
- </div>
|
|
|
|
|
- <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
|
|
|
|
|
- @click="handleBaseAction(item.actionBlock.key)">
|
|
|
|
|
- {{ item.actionBlock.text }}
|
|
|
|
|
- <el-icon><Edit /></el-icon>
|
|
|
|
|
- </div> -->
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div v-if="reportGenerating" class="report-progress report-progress--inline">
|
|
|
|
|
+ <div class="report-progress__content">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
|
|
|
|
|
+ striped striped-flow />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="report-progress__desc">
|
|
|
|
|
+ 依据您的农场定位,
|
|
|
|
|
+ <div>正在生成专属报告,预计耗时2分钟...</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="report-module">
|
|
|
|
|
- <div class="report-tabs">
|
|
|
|
|
- <div v-for="tab in reportTabs" :key="tab.key" class="report-tabs__item"
|
|
|
|
|
- :class="{ active: tab.key === activeReportTab }" @click="activeReportTab = tab.key">
|
|
|
|
|
- {{ tab.label }}
|
|
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <div class="base-data">
|
|
|
|
|
+ <!-- <div class="base-data__title">
|
|
|
|
|
+ <span class="title-dot"></span>
|
|
|
|
|
+ <span>基本信息</span>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ <div class="base-data__body">
|
|
|
|
|
+ <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
|
|
|
|
|
+ <div v-if="baseInfoList.length">
|
|
|
|
|
+ <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
|
|
|
|
|
+ <div class="base-info-item__row">
|
|
|
|
|
+ <span class="base-info-item__label">{{ item.label }}</span>
|
|
|
|
|
+ <span class="base-info-item__value">{{ item.value }}</span>
|
|
|
|
|
+ <!-- <span v-if="item.actionInline" class="base-info-action"
|
|
|
|
|
+ @click="handleBaseAction(item.actionInline.key)">
|
|
|
|
|
+ {{ item.actionInline.text }}
|
|
|
|
|
+ <el-icon><Edit /></el-icon>
|
|
|
|
|
+ </span> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
|
|
|
|
|
+ @click="handleBaseAction(item.actionBlock.key)">
|
|
|
|
|
+ {{ item.actionBlock.text }}
|
|
|
|
|
+ <el-icon><Edit /></el-icon>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="report-panel">
|
|
|
|
|
- <template v-if="activeModule">
|
|
|
|
|
- <div v-if="activeModule.lead" class="core-card">
|
|
|
|
|
- <div class="core-card__head">
|
|
|
|
|
- <img class="core-card__star" src="@/assets/img/home/start-icon.png" alt="" />
|
|
|
|
|
- <span>核心结论</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="core-card__body">{{ activeModule.lead }}</div>
|
|
|
|
|
|
|
+ <div class="report-module">
|
|
|
|
|
+ <div class="report-tabs">
|
|
|
|
|
+ <div v-for="tab in reportTabs" :key="tab.key" class="report-tabs__item"
|
|
|
|
|
+ :class="{ active: tab.key === activeReportTab }" @click="activeReportTab = tab.key">
|
|
|
|
|
+ {{ tab.label }}
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
- <div v-for="(block, bi) in activeModule.blocks" :key="`${block.no}-${bi}`"
|
|
|
|
|
- class="point-block" :class="`point-block--s${bi % 3}`">
|
|
|
|
|
- <div class="point-block__head">
|
|
|
|
|
- <span class="point-block__no">{{ block.no }}</span>
|
|
|
|
|
- <span class="point-block__title">{{ block.title }}</span>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="report-panel">
|
|
|
|
|
+ <template v-if="activeModule">
|
|
|
|
|
+ <div v-if="activeModule.lead" class="core-card">
|
|
|
|
|
+ <div class="core-card__head">
|
|
|
|
|
+ <img class="core-card__star" src="@/assets/img/home/start-icon.png" alt="" />
|
|
|
|
|
+ <span>核心结论</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="core-card__body">{{ activeModule.lead }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-if="block.sub?.length" class="point-block__card">
|
|
|
|
|
- <div v-for="(sub, si) in block.sub" :key="`${bi}-${si}`" class="point-sub">
|
|
|
|
|
- <!-- 样式 0:金色描边标签 -->
|
|
|
|
|
- <template v-if="bi % 3 === 0">
|
|
|
|
|
- <span class="point-sub__badge">{{ sub.title }}</span>
|
|
|
|
|
- <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 样式 1:纯白标题 -->
|
|
|
|
|
- <template v-else-if="bi % 3 === 1">
|
|
|
|
|
- <div class="point-sub__plain">{{ sub.title }}</div>
|
|
|
|
|
- <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 样式 2:图标 + 标题 -->
|
|
|
|
|
- <template v-else>
|
|
|
|
|
- <div class="point-sub__icon-row">
|
|
|
|
|
- <span class="point-sub__icon">
|
|
|
|
|
- <el-icon size="16">
|
|
|
|
|
- <List />
|
|
|
|
|
- </el-icon>
|
|
|
|
|
- </span>
|
|
|
|
|
- <span class="point-sub__icon-title">{{ sub.title }}</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div v-for="(block, bi) in activeModule.blocks" :key="`${block.no}-${bi}`"
|
|
|
|
|
+ class="point-block" :class="`point-block--s${bi % 3}`">
|
|
|
|
|
+ <div class="point-block__head">
|
|
|
|
|
+ <span class="point-block__no">{{ block.no }}</span>
|
|
|
|
|
+ <span class="point-block__title">{{ block.title }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="block.sub?.length" class="point-block__card">
|
|
|
|
|
+ <div v-for="(sub, si) in block.sub" :key="`${bi}-${si}`" class="point-sub">
|
|
|
|
|
+ <!-- 样式 0:金色描边标签 -->
|
|
|
|
|
+ <template v-if="bi % 3 === 0">
|
|
|
|
|
+ <span class="point-sub__badge">{{ sub.title }}</span>
|
|
|
|
|
+ <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 样式 1:纯白标题 -->
|
|
|
|
|
+ <template v-else-if="bi % 3 === 1">
|
|
|
|
|
+ <div class="point-sub__plain">{{ sub.title }}</div>
|
|
|
|
|
+ <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 样式 2:图标 + 标题 -->
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <div class="point-sub__icon-row">
|
|
|
|
|
+ <span class="point-sub__icon">
|
|
|
|
|
+ <el-icon size="16">
|
|
|
|
|
+ <List />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span class="point-sub__icon-title">{{ sub.title }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="point-sub__text">{{ sub.text }}</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <div v-else class="report-panel__empty">暂无报告内容</div>
|
|
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <div v-else class="report-panel__empty">暂无报告内容</div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </template>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</div>
|
|
</div>
|
|
@@ -225,6 +244,8 @@ const progressPercent = ref(10);
|
|
|
/** 分区列表(getZones) */
|
|
/** 分区列表(getZones) */
|
|
|
const zoneList = ref([]);
|
|
const zoneList = ref([]);
|
|
|
const selectedZoneId = ref(null);
|
|
const selectedZoneId = ref(null);
|
|
|
|
|
+/** 新增品种前校验范围,避免重复跳转 */
|
|
|
|
|
+const addVarietyChecking = ref(false);
|
|
|
const headerDesc = ref("");
|
|
const headerDesc = ref("");
|
|
|
const headerBase = ref("");
|
|
const headerBase = ref("");
|
|
|
const baseInfoList = ref([]);
|
|
const baseInfoList = ref([]);
|
|
@@ -632,17 +653,19 @@ async function pollLatlonReport({ pointText, crop }, token) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 无农场:按定位点 + 水稻拉取 / 轮询六模块报告 */
|
|
|
|
|
|
|
+/** 无农场:按定位点 + 水稻拉取 / 轮询六模块报告(请求期间即展示整页进度条) */
|
|
|
async function fetchLatlonReport(token) {
|
|
async function fetchLatlonReport(token) {
|
|
|
const pointText = getPointText();
|
|
const pointText = getPointText();
|
|
|
const crop = NO_FARM_CROP;
|
|
const crop = NO_FARM_CROP;
|
|
|
const params = { pointText, crop };
|
|
const params = { pointText, crop };
|
|
|
|
|
|
|
|
- loading.value = true;
|
|
|
|
|
|
|
+ // 无农场不用整页 v-loading,避免遮住 reportGenerating 进度条
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ beginProgress({});
|
|
|
try {
|
|
try {
|
|
|
const raw = await VE_API.report.report6Latlon({
|
|
const raw = await VE_API.report.report6Latlon({
|
|
|
point_text: pointText,
|
|
point_text: pointText,
|
|
|
- crop: '水稻',
|
|
|
|
|
|
|
+ crop: "水稻",
|
|
|
});
|
|
});
|
|
|
if (token !== viewToken) return;
|
|
if (token !== viewToken) return;
|
|
|
const res = Array.isArray(raw) ? raw[0] : raw;
|
|
const res = Array.isArray(raw) ? raw[0] : raw;
|
|
@@ -652,7 +675,6 @@ async function fetchLatlonReport(token) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
resetReportView({});
|
|
resetReportView({});
|
|
|
- beginProgress({});
|
|
|
|
|
startReportPolling("latlon", params, token);
|
|
startReportPolling("latlon", params, token);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
if (token !== viewToken) return;
|
|
if (token !== viewToken) return;
|
|
@@ -661,8 +683,6 @@ async function fetchLatlonReport(token) {
|
|
|
reportGenerating.value = false;
|
|
reportGenerating.value = false;
|
|
|
stopProgressTimer();
|
|
stopProgressTimer();
|
|
|
ElMessage.error("报告加载失败");
|
|
ElMessage.error("报告加载失败");
|
|
|
- } finally {
|
|
|
|
|
- if (token === viewToken) loading.value = false;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -713,6 +733,7 @@ async function fetchDiagnosisReport() {
|
|
|
if (farmId == null || farmId === "") {
|
|
if (farmId == null || farmId === "") {
|
|
|
zoneList.value = [];
|
|
zoneList.value = [];
|
|
|
selectedZoneId.value = null;
|
|
selectedZoneId.value = null;
|
|
|
|
|
+ loading.value = false;
|
|
|
await fetchLatlonReport(token);
|
|
await fetchLatlonReport(token);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -743,12 +764,74 @@ const handleSelectZone = (zone) => {
|
|
|
fetchFarmReport(getSelectedFarm(), token);
|
|
fetchFarmReport(getSelectedFarm(), token);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-/** 与巡园面板一致:进入新增分区 */
|
|
|
|
|
-const goAddVariety = () => {
|
|
|
|
|
- router.push({
|
|
|
|
|
- path: "/add_zone",
|
|
|
|
|
- query: { type: "region", isSuccessPopup: "1" },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+/** status=1 表示已勾画种植范围;信息不全 / 校验异常时不拦截 */
|
|
|
|
|
+async function hasZoneRange(zoneId) {
|
|
|
|
|
+ const farm = getSelectedFarm();
|
|
|
|
|
+ const farmId = farm.farm_id ?? farm.id;
|
|
|
|
|
+ if (farmId == null || farmId === "" || zoneId == null || zoneId === "") return true;
|
|
|
|
|
+ const belongsToFarm = zoneList.value.some((z) => String(z.zone_id) === String(zoneId));
|
|
|
|
|
+ if (!belongsToFarm) return false;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await VE_API.questionnaire.checkZoneRange({
|
|
|
|
|
+ farm_id: farmId,
|
|
|
|
|
+ zone_id: zoneId,
|
|
|
|
|
+ });
|
|
|
|
|
+ return Number(res?.data?.status) === 1;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.warn("[diagnosisReport] checkZoneRange failed", e);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 新增品种前校验当前选中品种是否已勾画范围(同 patrolPanel):
|
|
|
|
|
+ * 已勾画 → 直接进新增分区;未勾画 → 先 type=farm 画范围,
|
|
|
|
|
+ * 画完后 addZone 会继续进 type=region&isSuccessPopup=1
|
|
|
|
|
+ */
|
|
|
|
|
+const goAddVariety = async () => {
|
|
|
|
|
+ if (addVarietyChecking.value) return;
|
|
|
|
|
+ const goRegionAdd = () => {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/add_zone",
|
|
|
|
|
+ query: { type: "region", isSuccessPopup: "1" },
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const zoneId = selectedZoneId.value;
|
|
|
|
|
+ if (zoneId == null || zoneId === "") {
|
|
|
|
|
+ goRegionAdd();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ addVarietyChecking.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (await hasZoneRange(zoneId)) {
|
|
|
|
|
+ goRegionAdd();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const currentZone = zoneList.value.find(
|
|
|
|
|
+ (z) => String(z.zone_id) === String(zoneId),
|
|
|
|
|
+ );
|
|
|
|
|
+ const varietyName = currentZone?.zone_name || "当前品类";
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: `请先勾画「${varietyName}」的种植范围,\n完成后再新增品种`,
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ customClass: "restore-planting-message",
|
|
|
|
|
+ zIndex: 40000,
|
|
|
|
|
+ });
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/add_zone",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ type: "farm",
|
|
|
|
|
+ continueAddVariety: "1",
|
|
|
|
|
+ zoneId,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 800);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ addVarietyChecking.value = false;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 转发种植全析:带 farm_id / zone_id / fromShare */
|
|
/** 转发种植全析:带 farm_id / zone_id / fromShare */
|
|
@@ -913,6 +996,12 @@ onBeforeUnmount(() => {
|
|
|
padding: 0 36px;
|
|
padding: 0 36px;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
+ &--inline {
|
|
|
|
|
+ min-height: 320px;
|
|
|
|
|
+ padding: 90px 24px 32px;
|
|
|
|
|
+ align-items: flex-start;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
:deep(.el-progress) {
|
|
:deep(.el-progress) {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|