|
@@ -173,6 +173,14 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 农情采集成功弹窗 -->
|
|
|
|
|
+ <tip-popup
|
|
|
|
|
+ v-model:show="showSuccessPopup"
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ text="农情采集成功"
|
|
|
|
|
+ @confirm="handlePopupConfirm"
|
|
|
|
|
+ @handleClickOverlay="handlePopupConfirm"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
@@ -185,6 +193,7 @@ import { useStore } from "vuex";
|
|
|
import { convertPointToArray } from "@/utils/index";
|
|
import { convertPointToArray } from "@/utils/index";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
|
import { Checkbox } from "vant";
|
|
import { Checkbox } from "vant";
|
|
|
|
|
+import tipPopup from "@/components/popup/tipPopup.vue";
|
|
|
import wx from "weixin-js-sdk";
|
|
import wx from "weixin-js-sdk";
|
|
|
import { transformFromGCJToWGS, transformFromWGSToGCJ } from "@/utils/WSCoordinate.js";
|
|
import { transformFromGCJToWGS, transformFromWGSToGCJ } from "@/utils/WSCoordinate.js";
|
|
|
|
|
|
|
@@ -195,6 +204,14 @@ const store = useStore();
|
|
|
const indexMap = new IndexMap();
|
|
const indexMap = new IndexMap();
|
|
|
const mapContainer = ref(null);
|
|
const mapContainer = ref(null);
|
|
|
|
|
|
|
|
|
|
+// 农情采集成功弹窗
|
|
|
|
|
+const showSuccessPopup = ref(false);
|
|
|
|
|
+
|
|
|
|
|
+const handlePopupConfirm = () => {
|
|
|
|
|
+ showSuccessPopup.value = false;
|
|
|
|
|
+ router.replace(`/home`);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 标记是否从编辑地图页面确认返回
|
|
// 标记是否从编辑地图页面确认返回
|
|
|
const isFromEditMap = ref(false);
|
|
const isFromEditMap = ref(false);
|
|
|
|
|
|
|
@@ -579,7 +596,6 @@ const submitForm = (formEl) => {
|
|
|
store.commit("home/SET_EDIT_FARM_DATA", null); // 清除编辑数据
|
|
store.commit("home/SET_EDIT_FARM_DATA", null); // 清除编辑数据
|
|
|
polygonArr.value = null;
|
|
polygonArr.value = null;
|
|
|
isFromEditMap.value = false;
|
|
isFromEditMap.value = false;
|
|
|
- localStorage.setItem("isGarden", true);
|
|
|
|
|
|
|
|
|
|
if (route.query.type !== "edit" && curRole == 0) {
|
|
if (route.query.type !== "edit" && curRole == 0) {
|
|
|
localStorage.setItem("selectedFarmId", res.data.id);
|
|
localStorage.setItem("selectedFarmId", res.data.id);
|
|
@@ -591,17 +607,26 @@ const submitForm = (formEl) => {
|
|
|
if (fromPage && fromPage !== "details") {
|
|
if (fromPage && fromPage !== "details") {
|
|
|
// 如果是从monitor页面来的
|
|
// 如果是从monitor页面来的
|
|
|
router.replace(`/${fromPage}`);
|
|
router.replace(`/${fromPage}`);
|
|
|
- if (fromPage === "home") {
|
|
|
|
|
- let showSuccess = false;
|
|
|
|
|
- if (localStorage.getItem("isGarden") != "true" && curRole == 0) {
|
|
|
|
|
- showSuccess = true;
|
|
|
|
|
- }
|
|
|
|
|
- router.replace(`/home?showSuccess=${showSuccess}`);
|
|
|
|
|
- }
|
|
|
|
|
} else if (fromPage === "details") {
|
|
} else if (fromPage === "details") {
|
|
|
router.go(-1);
|
|
router.go(-1);
|
|
|
} else {
|
|
} else {
|
|
|
- router.replace(`/home`);
|
|
|
|
|
|
|
+ if(route.query.miniJson) {
|
|
|
|
|
+ const json = JSON.parse(route.query.miniJson);
|
|
|
|
|
+ //上传图片
|
|
|
|
|
+ VE_API.ali.uploadImg({
|
|
|
|
|
+ farmId: res.data.id,
|
|
|
|
|
+ images: json.images,
|
|
|
|
|
+ uploadDate: formatDate(new Date()),
|
|
|
|
|
+ }).then(({ code,msg }) => {
|
|
|
|
|
+ if(code === 0) {
|
|
|
|
|
+ showSuccessPopup.value = true;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ElMessage.error(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ router.replace(`/home`);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
ElMessage.error(res.msg);
|
|
ElMessage.error(res.msg);
|
|
@@ -727,6 +752,18 @@ function getFruitsTypeItemList(parentId) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 格式化日期为 YYYY-MM-DD 格式
|
|
|
|
|
+ * @param {Date} date - 日期对象
|
|
|
|
|
+ * @returns {string} 格式化后的日期字符串
|
|
|
|
|
+ */
|
|
|
|
|
+function formatDate(date) {
|
|
|
|
|
+ const year = date.getFullYear()
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
+ return `${year}-${month}-${day}`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function backgToHome() {
|
|
function backgToHome() {
|
|
|
ruleFormRef.value?.resetFields();
|
|
ruleFormRef.value?.resetFields();
|
|
|
|
|
|