浏览代码

feat:对接农事忽略接口

wangsisi 15 小时之前
父节点
当前提交
fab6ff0801

+ 5 - 0
src/api/modules/home.js

@@ -88,4 +88,9 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_arrange/futureFarmWorkWarning",
         type: "get",
     },
+    //农资忽略农事库
+    ignoreFarmWorkLib:{
+        url: config.base_dev_url + "z_farm_work_lib/ignoreFarmWorkLib",
+        type: "get",
+    },
 }

+ 26 - 16
src/components/pageComponents/AgriculturalInteractionCard.vue

@@ -10,9 +10,7 @@
                 <div class="date">
                     <span class="work-name">{{ timelineItem.farmWorkName }}</span>
                     <span v-show="timelineItem.expectedRisk">({{ timelineItem.expectedRisk }})</span>
-                    <span class="ignore-btn" @click="handleIgnore(timelineItem, item.farmId)">
-                        忽略
-                    </span>
+                    <span class="ignore-btn" @click="handleIgnore(timelineItem)"> 忽略 </span>
                 </div>
                 <div class="text">
                     预计报价<span class="price">{{ timelineItem.estimatedCost }}元</span>
@@ -33,7 +31,7 @@
 import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import { computed, onMounted, ref } from "vue";
-import { ElMessage } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 
 const props = defineProps({
     item: {
@@ -61,13 +59,12 @@ onMounted(() => {
     getManagerList();
 });
 
-
-// 查询当前农资店的成员列表(只保留有“任务接单”权限的成员)
+// 查询当前农资店的成员列表(只保留有"任务接单"权限的成员)
 const getManagerList = async () => {
-    const { data } = await VE_API.mine.listManagerList({onlyExecutor: true});
+    const { data } = await VE_API.mine.listManagerList({ onlyExecutor: true });
     if (data && data.length > 0) {
-        // 过滤 permissionList 中包含“任务接单”的成员
-        executorList.value = data;
+        // 过滤 permissionList 中包含"任务接单"的成员,并过滤掉超管(role为1)
+        executorList.value = data.filter((item) => item.role !== 1);
     }
 };
 
@@ -83,18 +80,33 @@ const handleTimelineAction = (timelineItem, farmId) => {
             arrangeIdVal: timelineItem.arrangeId,
             executorListVal: executorList.value,
         });
-    }else{
+    } else {
         ElMessage.warning("您暂无权限操作");
     }
 };
 
+const emits = defineEmits(["updateList"]);
+
 const handleUploadSuccess = async () => {
-    emit('handleUploadSuccess');
+    emits("updateList");
 };
 
-const handleIgnore = (timelineItem, farmId) => {
-    console.log('timelineItem', timelineItem);
-    console.log('farmId', farmId);
+// 忽略农事库
+const handleIgnore = ({ farmWorkId }) => {
+    ElMessageBox.confirm("确认忽略该农事吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+    })
+        .then(() => {
+            VE_API.home.ignoreFarmWorkLib({ farmWorkLibId: farmWorkId }).then(({ code }) => {
+                if (code === 0) {
+                    ElMessage.success("忽略成功");
+                    handleUploadSuccess()
+                }
+            });
+        })
+        .catch(() => {});
 };
 
 const priceSheetPopupRef = ref(null);
@@ -104,8 +116,6 @@ const showPriceSheetPopup = (item) => {
         priceSheetPopupRef.value.handleShowPopup(res);
     });
 };
-
-const emit = defineEmits(["handleUploadSuccess"]);
 </script>
 
 <style scoped lang="scss">

+ 1 - 1
src/views/old_mini/home/components/AgriculturalDynamics.vue

@@ -41,7 +41,7 @@
                     ></div>
 
                     <!-- 时间轴组件,只负责时间轴区域 -->
-                    <AgriculturalInteractionCard :item="item" @handleUploadSuccess="getUnansweredFarms" />
+                    <AgriculturalInteractionCard :item="item" @updateList="getUnansweredFarms" />
                 </div>
             </template>
         </div>