Browse Source

部分接口升级

shuhao 1 week ago
parent
commit
8bf939fddb

+ 3 - 3
src/api/modules/farm.js

@@ -90,12 +90,12 @@ module.exports = {
         url: config.base_dev_url + "container/growthReport/generate/result",
         type: "get",
     },
-    growthReportByFarm: {
-        url: config.base_dev_url + "container/growthReport/listByFarm",
+    growthReportBySubject: {
+        url: config.base_dev_url + "container/growthReport/listBySubjectId",
         type: "get",
     },
     readReportByFarm: {
         url: config.base_dev_url + "container/growthReport/read",
         type: "get",
     },
-}
+}

+ 3 - 3
src/api/modules/home.js

@@ -34,8 +34,8 @@ module.exports = {
         url: config.base_dev_url + "work_code/phenology/quest/save",
         type: "post",
     },
-    getExpertByFarmId: {
-        url: config.base_dev_url + "v2/farm/getExpertByFarmId",
+    getExpertBySubjectId: {
+        url: config.base_dev_url + "v3/farm/getExpertBySubjectId",
         type: "get",
     },
     // 查询当前农资用户的所有方案列表
@@ -128,4 +128,4 @@ module.exports = {
         url: config.base_dev_url + "container_phenology_interaction/uploadAnswerData",
         type: "post",
     },
-}
+}

+ 7 - 7
src/components/weatherInfo.vue

@@ -122,7 +122,7 @@ async function setFarmByGardenId(gardenIdValue) {
     if (!gardenIdValue) {
         return false;
     }
-    
+
     // 先刷新农场列表,确保数据是最新的
     return new Promise((resolve) => {
         VE_API.farm.listByUserId().then(({data}) => {
@@ -171,7 +171,7 @@ function getFarmList() {
         });
         return;
     }
-    
+
     // 如果没有传入 gardenId,执行正常逻辑
     getFarmListWithoutGardenId();
 }
@@ -188,7 +188,7 @@ function selectFarmFromList(data) {
             farmName.value = savedFarmName;
             farmId.value = Number(savedFarmId);
             isDefaultFarm.value = savedFarm.defaultOption || false;
-            localStorage.setItem('selectedFarmPoint', savedFarm.point);
+            localStorage.setItem('selectedFarmPoint', savedFarm.wkt);
         } else {
             // 如果保存的农场不在列表中,按优先级选择
             selectDefaultFarm(data);
@@ -226,7 +226,7 @@ watch(() => props.gardenId, (newGardenId) => {
 function selectDefaultFarm(data) {
     // 首先查找 defaultOption 为 true 的农场
     const defaultFarm = data.find(farm => farm.defaultOption === true);
-    
+
     if (defaultFarm) {
         // 如果有默认农场,选择它
         farmName.value = defaultFarm.name;
@@ -240,7 +240,7 @@ function selectDefaultFarm(data) {
         isDefaultFarm.value = data[0].defaultOption || false;
         localStorage.setItem('selectedFarmPoint', data[0].point);
     }
-    
+
     // 保存到 localStorage
     localStorage.setItem('selectedFarmId', farmId.value);
     localStorage.setItem('selectedFarmName', farmName.value);
@@ -266,7 +266,7 @@ const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
 function getLocationName() {
     const farmLocation = convertPointToArray(localStorage.getItem('selectedFarmPoint'));
     let formattedLocation = null;
-    
+
     if (farmLocation) {
         formattedLocation = `${farmLocation[1]},${farmLocation[0]}`;
     } else {
@@ -343,7 +343,7 @@ const currentDateText = computed(() => {
         border-radius: 8px;
         padding: 10px 12px;
     }
-    
+
     &.expanded {
         height: 312px;
     }

+ 2 - 2
src/views/old_mini/growth_report/index.vue

@@ -129,7 +129,7 @@ const getDetail = () => {
     if (!paramsPage.value.farmId) return;
     loading.value = true;
     VE_API.farm
-        .growthReportByFarm({ farmId: paramsPage.value.farmId, limit: 20 })
+        .growthReportBySubject({ subjectId: paramsPage.value.farmId, limit: 20 })
         .then(({ data }) => {
             workItem.value = data[0];
             setReadStatus(data[0].id);
@@ -200,7 +200,7 @@ onUnmounted(() => {
             }
         }
     }
-    
+
     .code-icon {
         position: absolute;
         right: 10px;

+ 5 - 5
src/views/old_mini/home/index copy.vue

@@ -81,14 +81,14 @@ const gardenId = ref(null);
 const isGarden = ref(false);
 const changeGarden = ({ id }) => {
     gardenId.value = id;
-    getExpertByFarmId();
+    getExpertBySubjectId();
 };
 
 const expertInfo = ref({});
-const getExpertByFarmId = () => {
-    VE_API.home.getExpertByFarmId({ farmId: gardenId.value }).then(({ data }) => {
-        expertInfo.value = data || {};
-        sessionStorage.setItem("expertId", data.appUserId);
+const getExpertBySubjectId = () => {
+    VE_API.home.getExpertBySubjectId({ subjectId: gardenId.value }).then(({ data }) => {
+        expertInfo.value = data[0] || {};
+        sessionStorage.setItem("expertId", data[0].appUserId);
     });
 };
 

+ 5 - 5
src/views/old_mini/home/index.vue

@@ -2,7 +2,7 @@
     <div class="home-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
         <!-- <div class="banner-wrap" @click="handleBannerClick">
             <img class="banner-img" :src="bannerObj?.media?.[0]" alt="" />
-            <div class="banner-title">  
+            <div class="banner-title">
                 <span class="van-multi-ellipsis--l2">{{ bannerObj?.title }}</span>
             </div>
         </div> -->
@@ -180,13 +180,13 @@ async function checkExistsEnabledScheme() {
 const gardenId = ref(null);
 const changeGarden = ({ id }) => {
     gardenId.value = id;
-    getExpertByFarmId();
+    getExpertBySubjectId();
     getReport();
 };
 
 const expertInfo = ref({});
-const getExpertByFarmId = () => {
-    VE_API.home.getExpertByFarmId({ farmId: gardenId.value }).then(({ data, code }) => {
+const getExpertBySubjectId = () => {
+    VE_API.home.getExpertBySubjectId({ subjectId: gardenId.value }).then(({ data, code }) => {
        if(code === 0) {
             expertInfo.value = data || {};
             sessionStorage.setItem("expertId", data.appUserId);
@@ -197,7 +197,7 @@ const getExpertByFarmId = () => {
 const showReportPopup = ref(false);
 const getReport = () => {
     if (!gardenId.value) return;
-    VE_API.farm.growthReportByFarm({ farmId: gardenId.value, limit: 20, isRead: 0 ,generateStatus:1}).then(({ data }) => {
+    VE_API.farm.growthReportBySubject({ subjectId: gardenId.value, limit: 20, isRead: 0 ,generateStatus:1}).then(({ data }) => {
         if (data && data.length > 0) {
             showReportPopup.value = true;
         } else {

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

@@ -121,7 +121,7 @@ onActivated(() => {
         // 统一转换为布尔值
         isDefaultFarm.value = route.query.defaultFarm === "true" || route.query.defaultFarm === true;
     }
-    
+
     getReport();
 });
 
@@ -392,7 +392,7 @@ const handleClosePopup = () => {
 }
 
 const getReport = () => {
-    VE_API.farm.growthReportByFarm({farmId: gardenId.value, limit: 20}).then(({ data }) => {
+    VE_API.farm.growthReportBySubject({subjectId: gardenId.value, limit: 20}).then(({ data }) => {
         if (data && data.length > 0) {
             hasReport.value = true;
         } else {

+ 1 - 0
vue.config.js

@@ -98,6 +98,7 @@ module.exports = {
         ]
         let baseConfig = {
             plugins: plugins,
+            devtool: 'source-map',
             module: { unknownContextCritical: false }
         };
         let envConfig = {};