Pārlūkot izejas kodu

feat:对接农资请求确认上传图片接口

wangsisi 14 stundas atpakaļ
vecāks
revīzija
cfe9089662

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

@@ -22,4 +22,9 @@ module.exports = {
         url: url + "/updateFlowStatus",
         type: "post",
     },
+    //添加执行图片
+    addExecuteImg: {
+        url: url + "/addExecuteImg",
+        type: "post",
+    },
 }

+ 49 - 0
src/components/pageComponents/FnShareSheet.vue

@@ -0,0 +1,49 @@
+<template>
+    <share-sheet
+        teleport="#app"
+        v-model:show="internalShow"
+        title="立即分享给好友"
+        :options="options"
+        @select="handleSelect"
+    />
+</template>
+
+<script setup>
+import { ShareSheet } from "vant";
+import { computed } from "vue";
+
+const props = defineProps({
+    show: {
+        type: Boolean,
+        default: false,
+    },
+    options: {
+        type: Array,
+        default: () => [
+            { name: "飞鸟用户", icon: "https://birdseye-img.sysuimars.com/birdseye-look-mini/Group%201321316260.png" ,type: "birdseye"},
+            { name: "微信", icon: "wechat", type: "wechat" },
+        ],
+    },
+});
+
+const emit = defineEmits(["update:show", "select"]);
+
+const internalShow = computed({
+    get() {
+        return props.show;
+    },
+    set(val) {
+        emit("update:show", val);
+    },
+});
+
+function handleSelect(option) {
+    emit("update:show", false);
+    emit("select", option);
+}
+</script>
+
+<style scoped>
+</style>
+
+

+ 1 - 1
src/components/popup/activeUploadPopup.vue

@@ -16,7 +16,7 @@
             </div>
         </div>
         <div class="tips-text">上传照片,诊断更准确哦~</div>
-        <upload :textShow="true" class="upload-wrap" exampleImg placeholderImg>
+        <upload :textShow="true" class="upload-wrap" exampleImg>
             <img class="example" src="@/assets/img/home/example-4.png" alt="" />
             <img class="example" src="@/assets/img/home/plus.png" alt="">
         </upload>

+ 1 - 1
src/styles/common.scss

@@ -314,4 +314,4 @@ div {
             border: none;
         }
     }
-}
+}

+ 13 - 3
src/views/old_mini/modify_work/completedWork.vue

@@ -258,7 +258,7 @@
                 class="fixed-btn-wrap"
                 v-if="curRole == 2 && currentStep == 2"
             >
-                <div class="fixed-btn second">转发给客户</div>
+                <div class="fixed-btn second" @click="handleShare">转发给客户</div>
                 <div class="fixed-btn" @click="showUploadExecutePopup">请求确认</div>
             </div>
         </div>
@@ -283,7 +283,7 @@
     </popup>
 
     <!-- 上传执行照片 -->
-    <upload-execute ref="uploadExecuteRef" />
+    <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" />
 </template>
 
 <script setup>
@@ -376,8 +376,18 @@ const handleConfirmExecute = () => {
 })
 };
 
+const onlyShare = ref(false);
+const handleShare = () => {
+    onlyShare.value = true;
+    setTimeout(() => {
+        uploadExecuteRef.value.showPopup();
+    }, 10);
+};
 const showUploadExecutePopup = () => {
-    uploadExecuteRef.value.showPopup();
+    onlyShare.value = false;
+    setTimeout(() => {
+        uploadExecuteRef.value.showPopup(query.id);
+    }, 10);
 };
 // 地图
 // const areaRef = ref(null);

+ 8 - 8
src/views/old_mini/monitor/index.vue

@@ -193,14 +193,14 @@ const onLoad = () => {
 };
 // 卡片点击事件
 const handleCardClick = (card) => {
-    if (card.route === "/plan") {
-        router.push({
-            path: card.route,
-            query: { farmId: gardenId.value },
-        });
-        return;
-    }
-    router.push(card.route);
+    const params = {
+        farmId: gardenId.value,
+        containerId: card.containerId,
+    };
+    router.push({
+        path: card.route,
+        query: params,
+    });
 };
 
 // 播报相关事件

+ 11 - 2
src/views/old_mini/task_condition/components/task.vue

@@ -68,7 +68,7 @@
             </div>
         </div>
     </div>
-    <upload-execute ref="uploadExecuteRef" />
+    <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" />
 
     <popup v-model:show="showTaskPopup" round class="task-tips-popup">
         <template v-if="taskPopupType === 'warning'">
@@ -225,7 +225,10 @@ function handleActiveFilter(i) {
 function toPage(item) {
     // router.push("/servicZes_agri")
     if (activeIndex.value === 1) {
-        uploadExecuteRef.value.showPopup();
+        onlyShare.value = false;
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup(item.id,'share-sheet');
+        }, 10);
     } else {
         // 下发农事请求
         const data = {
@@ -256,12 +259,18 @@ function toDetail(item) {
     }
 }
 
+const onlyShare = ref(false);
 const currentTask = ref(null);
 function handleAction(item) {
     if (activeIndex.value === 0) {
         taskPopupType.value = 'warning';
         showTaskPopup.value = true;
         currentTask.value = item;
+    }else{
+        onlyShare.value = true;
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup(item.id,'share-sheet');
+        }, 10);
     }
 }
 

+ 59 - 6
src/views/old_mini/task_condition/components/uploadExecute.vue

@@ -11,24 +11,65 @@
                 请上传执行照片
             </div>
         </div>
-        <upload :textShow="true" class="upload-wrap"></upload>
-        <div class="btn" @click="handleUpload">请求确认</div>
+        <upload exampleImg class="upload-wrap" @handleUpload="handleUpload">
+            <img class="example" src="@/assets/img/home/example-4.png" alt="" />
+            <img class="example" src="@/assets/img/home/plus.png" alt="">
+        </upload>
+        <div class="btn" @click="handleConfirm">请求确认</div>
     </popup>
+    <FnShareSheet v-model:show="showShare" @select="onSelect" :class="className" />
 </template>
 
 <script setup>
 import { Popup } from "vant";
-import { onMounted, onUnmounted, ref } from "vue";
+import { ref } from "vue";
 import upload from "@/components/upload";
 import { ElMessage } from "element-plus";
+import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
+
+const props = defineProps({
+    onlyShare: {
+        type: Boolean,
+        default: false,
+    },
+});
 
 const show = ref(false);
+const className = ref(null);
+const farmWorkRecordId = ref(null);
+function showPopup(id,classNameVal) {
+    if (props.onlyShare) {
+        showShare.value = true;
+        className.value = classNameVal;
+    } else {
+        show.value = true;
+        farmWorkRecordId.value = id;
+    }
+}
+
+const images = ref([]);
+function handleUpload({imgArr}) {
+    images.value = imgArr;
+}
 
-function showPopup() {
-    show.value = true;
+function handleConfirm() {
+    const params = {
+        recordId: farmWorkRecordId.value,
+        executeEvidence: images.value,
+    };
+    VE_API.z_farm_work_record.addExecuteImg(params).then((res) => {
+        if (res.code === 0) {
+            ElMessage.success('请求确认成功');
+            show.value = false;
+            showShare.value = true;
+        }
+    });
 }
 
-function handleUpload() {}
+const showShare = ref(false);
+const onSelect = ({type}) => {
+    console.log(type);
+};
 
 defineExpose({
     showPopup,
@@ -69,6 +110,13 @@ defineExpose({
     .upload-wrap {
         margin: 12px 0 24px;
     }
+    .example {
+        width: 80px;
+        height: 80px;
+    }
+    .example + .example {
+        margin-left: 12px;
+    }
 }
 
 .btn {
@@ -81,3 +129,8 @@ defineExpose({
 }
 
 </style>
+<style>
+.share-sheet{
+    bottom: 50px;
+}
+</style>