|
|
@@ -21,6 +21,7 @@
|
|
|
v-for="(fw, aIdx) in Array.isArray(r.farmWorkArrangeList) ? r.farmWorkArrangeList : []"
|
|
|
:key="`arrange-${uniqueTimestamp}-${idx}-${rIdx}-${aIdx}`"
|
|
|
class="arrange-card"
|
|
|
+ :style="shouldShowIncompleteStatus(fw.farmWorkId) ? 'padding-bottom: 18px;' : 'padding-bottom: 10px'"
|
|
|
:class="getArrangeStatusClass(fw)"
|
|
|
@click="handleRowClick(fw)"
|
|
|
>
|
|
|
@@ -35,14 +36,14 @@
|
|
|
</div>
|
|
|
<div class="card-content">
|
|
|
<span>{{ fw.interactionQuestion || "暂无提示" }}</span>
|
|
|
- <span v-if="!disableClick" class="edit-link" @click.stop="handleEdit(fw)"
|
|
|
+ <span v-if="!disableClick" :class="shouldShowIncompleteStatus(fw.farmWorkId) ? 'link-warning' : 'edit-link'" @click.stop="handleEdit(fw)"
|
|
|
>点击编辑</span
|
|
|
>
|
|
|
</div>
|
|
|
- <!-- <div class="card-status">
|
|
|
- <el-icon color="#FF953D" size="14"><WarningFilled /></el-icon>
|
|
|
+ <div class="card-status" v-if="shouldShowIncompleteStatus(fw.farmWorkId)">
|
|
|
+ <el-icon color="#FF953D" size="13"><WarningFilled /></el-icon>
|
|
|
<span>未完善</span>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="phenology-name">{{ r.name }}</div>
|
|
|
@@ -51,13 +52,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 互动设置弹窗 -->
|
|
|
- <interact-popup ref="interactPopupRef" @handleSaveSuccess="getFarmWorkPlan"></interact-popup>
|
|
|
+ <interact-popup ref="interactPopupRef" @handleSaveSuccess="updateFarmWorkPlan"></interact-popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, nextTick, watch } from "vue";
|
|
|
+import { ref, nextTick, watch } from "vue";
|
|
|
import interactPopup from "@/components/popup/interactPopup.vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
+import { WarningFilled } from "@element-plus/icons-vue";
|
|
|
|
|
|
const props = defineProps({
|
|
|
// 农场 ID,用于请求农事规划数据
|
|
|
@@ -91,7 +93,6 @@ const props = defineProps({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
-
|
|
|
const farmWorkType = {
|
|
|
0: "预警农事",
|
|
|
1: "标准农事",
|
|
|
@@ -140,6 +141,49 @@ const safeParseDate = (val) => {
|
|
|
return NaN;
|
|
|
};
|
|
|
|
|
|
+const batchValidateData = ref({});
|
|
|
+// 验证农事卡片药肥报价信息是否完整
|
|
|
+const batchValidatePesticideFertilizerQuotes = (ids) => {
|
|
|
+ if (props.isStandard) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ VE_API.monitor
|
|
|
+ .batchValidatePesticideFertilizerQuotes({ ids, schemeId: props.schemeId })
|
|
|
+ .then(({ data,code }) => {
|
|
|
+ if (code === 0) {
|
|
|
+ batchValidateData.value = data || {};
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+
|
|
|
+// 判断是否应该显示"未完善"状态
|
|
|
+// 如果batchValidateData中对应的farmWorkId验证结果为true(已完善),则不显示
|
|
|
+// 如果验证结果为false(未完善)或不存在,则显示
|
|
|
+const shouldShowIncompleteStatus = (farmWorkId) => {
|
|
|
+ if (!farmWorkId || !batchValidateData.value || typeof batchValidateData.value !== 'object') {
|
|
|
+ // 如果没有验证数据,默认不显示
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从对象中直接获取验证结果,支持字符串和数字类型的key
|
|
|
+ const isValid = batchValidateData.value[farmWorkId] !== undefined
|
|
|
+ ? batchValidateData.value[farmWorkId]
|
|
|
+ : batchValidateData.value[String(farmWorkId)] !== undefined
|
|
|
+ ? batchValidateData.value[String(farmWorkId)]
|
|
|
+ : undefined;
|
|
|
+
|
|
|
+ // 如果找到了验证结果
|
|
|
+ if (isValid !== undefined) {
|
|
|
+ // 如果验证结果为true(已完善),返回false(不显示)
|
|
|
+ // 如果验证结果为false(未完善),返回true(显示)
|
|
|
+ return !isValid;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果没有找到验证结果,默认不显示
|
|
|
+ return false;
|
|
|
+};
|
|
|
+
|
|
|
// 计算物候期需要的实际高度(基于农事数量)
|
|
|
const getPhenologyRequiredHeight = (item) => {
|
|
|
// 统计该物候期内的农事数量
|
|
|
@@ -299,10 +343,11 @@ const handleSeasonClick = (seasonValue) => {
|
|
|
// 农事状态样式映射(0:取消关注,1:关注,2:托管农事,)
|
|
|
const getArrangeStatusClass = (fw) => {
|
|
|
const t = fw?.isFollow;
|
|
|
+ const warningStatus = shouldShowIncompleteStatus(fw.farmWorkId);
|
|
|
+ if (warningStatus) return "status-warning";
|
|
|
if (t == 0) return "normal-style";
|
|
|
// if (t >= 0 && t <= 4) return "status-normal";
|
|
|
// if (t === 5) return "status-complete";
|
|
|
- if (t === 6) return "status-warning";
|
|
|
return "status-normal";
|
|
|
};
|
|
|
|
|
|
@@ -407,6 +452,31 @@ const getFarmWorkPlan = () => {
|
|
|
timelineContainerRef.value.scrollTop = savedScrollTop;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 收集所有farmWorkId
|
|
|
+ const farmWorkIds = [];
|
|
|
+ phenologyList.value.forEach((phenology) => {
|
|
|
+ if (Array.isArray(phenology.reproductiveList)) {
|
|
|
+ phenology.reproductiveList.forEach((reproductive) => {
|
|
|
+ if (Array.isArray(reproductive.farmWorkArrangeList)) {
|
|
|
+ reproductive.farmWorkArrangeList.forEach((farmWork) => {
|
|
|
+ if (
|
|
|
+ farmWork.farmWorkId != null &&
|
|
|
+ farmWork.farmWorkId !== undefined &&
|
|
|
+ farmWork.farmWorkId !== ""
|
|
|
+ ) {
|
|
|
+ farmWorkIds.push(farmWork.farmWorkId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 调用验证方法,传入所有ids
|
|
|
+ if (farmWorkIds.length > 0) {
|
|
|
+ batchValidatePesticideFertilizerQuotes(farmWorkIds);
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
@@ -415,24 +485,28 @@ const getFarmWorkPlan = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const updateFarmWorkPlan = () => {
|
|
|
+ solarTerms.value = [];
|
|
|
+ phenologyList.value = [];
|
|
|
+ getFarmWorkPlan();
|
|
|
+};
|
|
|
+
|
|
|
watch(
|
|
|
() => props.farmId || props.containerId,
|
|
|
(val) => {
|
|
|
if (val) {
|
|
|
isInitialLoad.value = true;
|
|
|
- getFarmWorkPlan();
|
|
|
+ updateFarmWorkPlan();
|
|
|
}
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
);
|
|
|
watch(
|
|
|
() => props.schemeId,
|
|
|
- () => {
|
|
|
- // 清空旧数据,确保重新渲染
|
|
|
- solarTerms.value = [];
|
|
|
- phenologyList.value = [];
|
|
|
- // 触发数据重新加载
|
|
|
- getFarmWorkPlan();
|
|
|
+ (val) => {
|
|
|
+ if (val) {
|
|
|
+ updateFarmWorkPlan();
|
|
|
+ }
|
|
|
}
|
|
|
);
|
|
|
</script>
|
|
|
@@ -530,15 +604,19 @@ watch(
|
|
|
color: #2199f8;
|
|
|
margin-left: 5px;
|
|
|
}
|
|
|
+ .link-warning{
|
|
|
+ color: #ff953d;
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
}
|
|
|
- .card-status{
|
|
|
+ .card-status {
|
|
|
position: absolute;
|
|
|
bottom: 0;
|
|
|
right: 0;
|
|
|
background: rgba(255, 149, 61, 0.1);
|
|
|
border-radius: 3px;
|
|
|
- color: #FF953D;
|
|
|
- padding: 2px 6px;
|
|
|
+ color: #ff953d;
|
|
|
+ padding: 0 6px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 4px;
|