Browse Source

fix: 登录用户果园,对接接口

lxf 1 day ago
parent
commit
77a09412fb

+ 4 - 0
src/api/modules/manage_interface.js

@@ -53,5 +53,9 @@ module.exports = {
         url: config.base_url + "z_sample_lighten_card_offline_take/save",
         type: "post",
     },
+    cancelBindSample: {
+        url: config.base_url + "z_sample_lighten_card_offline_take/cancelBindSample",
+        type: "get",
+    },
     
 }

+ 16 - 6
src/components/addGroup.vue

@@ -95,6 +95,8 @@
 import { Popup } from "vant";
 import { onMounted, reactive, ref } from "vue";
 import { ElMessage } from "element-plus";
+import { useStore } from "vuex";
+const store = useStore();
 
 const showClient = ref(false);
 const ruleForm = reactive({
@@ -106,10 +108,12 @@ const rules = reactive({
     name: { required: true, message: "请输入分组名称", trigger: ["blur", "change"] },
 });
 
+const currentFarmId = store.getters.userinfo.curFarmId
+
 const ruleFormRef = ref(null);
 const submitForm = () => {
     const params = {
-        farmId: 766,
+        farmId: currentFarmId,
         groupId: ruleForm.id,
         telList: telList.value,
     };
@@ -137,18 +141,20 @@ const submitGroupName = async () => {
     await ruleFormRef.value.validate((valid, fields) => {
         if (valid) {
             const params = {
-                farmId: 766,
+                farmId: currentFarmId,
                 groupName: ruleForm.name,
             };
             VE_API.manage_user
                 .saveGroup(params)
-                .then(({ code }) => {
+                .then(({ data, code }) => {
                     if (code === 0) {
                         ElMessage.success("新建分组成功");
                         if (popupType.value === "add") {
                             showClient.value = false;
                         } else {
-                            getGroupList()
+                            console.log('data', data);
+                            clear()
+                            getGroupList(data.id)
                         }
                         emit("updateGroupList");
                     }
@@ -181,6 +187,7 @@ const groupOptions = ref([]);
 const isAddingItem = ref(false);
 
 const clear = () => {
+    ruleForm.name = null
     isAddingItem.value = false;
 };
 onMounted(() => {
@@ -204,9 +211,12 @@ const deleteGroup = (item, cancel) => {
 function deleteGroupFun() {
 }
 
-function getGroupList() {
-    VE_API.manage_user.fetchGroupList({farmId: 766}).then(({ data }) => {
+function getGroupList(hasVal) {
+    VE_API.manage_user.fetchGroupList({farmId: currentFarmId}).then(({ data }) => {
         groupOptions.value = data;
+        if (hasVal) {
+            ruleForm.id = hasVal
+        }
     });
 }
 

+ 4 - 1
src/components/editClientPopup.vue

@@ -66,7 +66,10 @@ import { Popup } from "vant";
 import { onMounted, reactive, ref } from 'vue';
 import { ElMessage } from "element-plus";
 import upload from "@/components/common/upload.vue";
+import { useStore } from "vuex";
+const store = useStore();
 
+const currentFarmId = store.getters.userinfo.curFarmId
 const showClient = ref(false);
 const ruleForm = reactive({
     name: "",
@@ -109,7 +112,7 @@ const submitForm = async () => {
 const groupOptions = ref([]);
 const isAddingItem = ref(false);
 function getGroupList() {
-    VE_API.manage_user.fetchGroupList({farmId: 766}).then(({ data }) => {
+    VE_API.manage_user.fetchGroupList({farmId: currentFarmId}).then(({ data }) => {
         groupOptions.value = data;
     });
 }

+ 2 - 1
src/views/customTree/index.vue

@@ -163,6 +163,7 @@ import editClientPopup from "@/components/editClientPopup.vue";
 import { useStore } from "vuex";
 let store = useStore();
 
+const currentFarmId = store.getters.userinfo.curFarmId
 const areaVal = ref(0);
 const areaOptions = ref([
     { label: "全区", value: 0 },
@@ -238,7 +239,7 @@ onMounted(() => {
 })
 
 function getSamplePage() {
-    VE_API.manage_interface.fetchSamplePage({farmId: 766, page: 1, limit: 1000}).then(({data}) => {
+    VE_API.manage_interface.fetchSamplePage({farmId: currentFarmId, page: 1, limit: 1000}).then(({data}) => {
         allTrees.value = data
     })
 }

+ 7 - 4
src/views/home/album_compoents/albumCarousel.vue

@@ -147,9 +147,12 @@ import AlbumCarouselItem from "./albumCarouselItem";
 import { dateFormat } from "@/utils/date_util.js";
 import eventBus from "@/api/eventBus";
 import { ElMessage, ElMessageBox } from "element-plus";
+import { useStore } from "vuex";
+const store = useStore();
 
+const currentFarmId = store.getters.userinfo.curFarmId
 const lock = ref(false);
-const farmId = ref(766);
+const farmId = ref(store.getters.userinfo.curFarmId);
 const nameRef = ref("");
 
 const isLoadingImg = ref(true);
@@ -218,7 +221,7 @@ function handleClickPoint({ farmId, sampleId, data }) {
 
 const userList = ref([])
 function getUserList() {
-    VE_API.manage_interface.offlineTakeList({farmId: 766}).then(({data}) => {
+    VE_API.manage_interface.offlineTakeList({farmId: currentFarmId}).then(({data}) => {
         userList.value = data
     })
 }
@@ -329,7 +332,7 @@ async function saveEdit(isToSave) {
                     const params = {
                         sampleIds: [sampleIdVal.value],
                         isRenyang: switchAuth.value ? 1 : 0,
-                        farmId: Number(sessionStorage.getItem("currentFarmId"))
+                        farmId: currentFarmId
                     };
                     
                     VE_API.manage_interface.batchOpenOrCloseSample(params)
@@ -352,7 +355,7 @@ async function saveEdit(isToSave) {
 
 const speciesList = ref([]);
 onMounted(() => {
-    VE_API.manage_interface.speciesList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.speciesList({ farmId: currentFarmId }).then(({ data }) => {
         speciesList.value = data;
     });
 })

+ 1 - 0
src/views/home/album_compoents/albumDrawBox.vue

@@ -92,6 +92,7 @@ function drawTargetRectangles2(img, obj) {
 
 async function drawWatermark1(event) {
   img = event.target
+  if (!img) {return}
   // await loadImage(props.photo.baseMap,"base_map_"+props.photo.treeId)
   // data.baseMap = imageCache.get("base_map_"+props.photo.treeId)
   if(!watermark.value){

+ 13 - 12
src/views/home/components/adoptList.vue

@@ -107,11 +107,11 @@
         </div>
 
         <div class="list-wrap">
-            <div class="no-data" v-show="!adoptList.length">暂无数据</div>
+            <div class="no-data" v-show="!adoptList || !adoptList.length">暂无数据</div>
             <div class="list-item" v-for="(item, index) in adoptList" :key="index">
-                <div class="list-info">
+                <div class="list-info" @click.stop="showTreeDialog(item)">
                     <div class="tree-icon">
-                        <div class="tree-tag" v-show="!item.miniUserId">守护</div>
+                        <div class="tree-tag" v-show="!item.miniUserId">守护</div>
                         <div class="tree-tag wait" v-show="item.miniUserId">已守护</div>
                         <img class="tree-img" src="@/assets/images/foster-home/tree-item.png" alt="" />
                         <!-- <img class="tree-img" :src="item.icon || require(`@/assets/images/foster-home/list/1.png`)" alt="" /> -->
@@ -206,7 +206,7 @@
                         <div
                             class="center-item p-t-2 user-wrap"
                             v-show="!item.miniUserId && !isManySetting && !item.settingPrice"
-                            @click="showTreeDialog(item)"
+                            @click.stop="showTreeDialog(item)"
                         >
                             <img src="@/assets/images/foster-home/user.png" alt="" />
                             <span class="user-text">选择预留守护人</span>
@@ -243,7 +243,7 @@
                             </span>
                         </div>
                     </div>
-                    <div v-show="!isManySetting && !item.settingPrice" @click="toSettingSinglePrice(index, true)">
+                    <div v-show="!isManySetting && !item.settingPrice" @click.stop="toSettingSinglePrice(index, true)">
                         <img src="@/assets/images/common/edit-icon.png" alt="" />
                     </div>
                 </div>
@@ -268,7 +268,7 @@
         </div>
 
         <!-- 渐变主色按钮 -->
-        <div class="center-btn" v-show="adoptList.length" @click="manySetPrice">批量编辑果树</div>
+        <div class="center-btn" v-show="adoptList && adoptList.length" @click="manySetPrice">批量编辑果树</div>
         <!-- 渐变主色按钮 -->
         <!-- <div class="btn-group list-btn" v-show="isManySetting">
             <div class="btn cancel-btn" @click="saveManySetting(0)">取消</div>
@@ -286,6 +286,7 @@ import { useRouter } from "vue-router";
 import eventBus from "@/api/eventBus";
 const router = useRouter();
 
+const currentFarmId = store.getters.userinfo.curFarmId
 const areaVal = ref(0);
 const areaOptions = ref([]);
 const typeVal = ref(0);
@@ -326,10 +327,10 @@ const offlineTakeSelected = ref(null);
 const userList = ref([]);
 const speciesList = ref([]);
 function getUserList() {
-    VE_API.manage_interface.offlineTakeList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.offlineTakeList({ farmId: currentFarmId }).then(({ data }) => {
         userList.value = data;
     });
-    VE_API.manage_interface.speciesList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.speciesList({ farmId: currentFarmId }).then(({ data }) => {
         speciesList.value = data;
     });
 }
@@ -340,7 +341,7 @@ onMounted(() => {
 });
 
 function getBlueRegionList() {
-    VE_API.manage_interface.fetchRegionList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.fetchRegionList({ farmId: currentFarmId }).then(({ data }) => {
         areaOptions.value = data;
     });
 }
@@ -357,12 +358,12 @@ function handleChageData() {
 function getSamplePage() {
     VE_API.manage_interface
         .fetchSamplePage({
-            farmId: 766,
+            farmId: currentFarmId,
             regionId: areaVal.value === 0 ? null : areaVal.value,
             isRenyang: statusVal.value === "-1" ? null : statusVal.value,
             ageRange: ageVal.value === 0 ? null : [ageVal.value - 10, ageVal.value],
             pz: typeVal.value === 0 ? null : typeVal.value,
-            page: currentPage.value,
+            page: currentPage.value - 1,
             limit: 20,
         })
         .then(({ data, count }) => {
@@ -420,7 +421,7 @@ function settingSinglePrice() {
 
 function showTreeDialog(item) {
     eventBus.emit("click:point", { 
-        farmId: 766, 
+        farmId: currentFarmId, 
         sampleId: item.sampleId, 
         data: item,
     });

+ 18 - 9
src/views/home/components/applyList.vue

@@ -55,7 +55,7 @@
                                             守护详情
                                         </div>
                                         <div class="header-r">
-                                            <div class="header-btn red" @click="warningMessage(item)">取消守护权限</div>
+                                            <div class="header-btn red" @click="warningMessage(item.name, tree.takeId)">取消守护权限</div>
                                             <!-- <div class="header-btn" @click="toCustomOneTree(item)">更换守护树</div> -->
                                         </div>
                                     </div>
@@ -109,8 +109,15 @@ import editClientPopup from "@/components/editClientPopup.vue";
 import eventBus from "@/api/eventBus";
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { useRouter } from "vue-router";
-import { Search } from '@element-plus/icons-vue'
+import { Search } from '@element-plus/icons-vue';
+
+import { useStore } from "vuex";
+const store = useStore();
+
+const currentFarmId = store.getters.userinfo.curFarmId
 const router = useRouter();
+
+
 const props = defineProps({
     // 是否开始重新加载列表
     startReloadList: {
@@ -132,7 +139,7 @@ onMounted(() => {
 });
 
 function getUserList() {
-    VE_API.manage_interface.fetchGroupList({ farmId: 766, isAllot: 1, word: searchWord.value }).then(({ data }) => {
+    VE_API.manage_interface.fetchGroupList({ farmId: currentFarmId, isAllot: 1, word: searchWord.value }).then(({ data }) => {
         groupList.value = Object.keys(data)
             .filter(key => data[key] && data[key].length > 0) // 先过滤掉空的 key
             .map(key => ({
@@ -144,7 +151,7 @@ function getUserList() {
 
 function showTreeDialog(item, tree) {
     eventBus.emit("click:point", { 
-        farmId: 766, 
+        farmId: currentFarmId, 
         sampleId: tree.sampleId, 
         data: {
             ...tree,
@@ -156,17 +163,17 @@ function showTreeDialog(item, tree) {
 }
 
 // 取消守护权限
-function warningMessage(item) {
-    ElMessageBox.confirm(`确认取消 ${item.name} 的守护权限吗?`, '提示', {
+function warningMessage(name, id) {
+    ElMessageBox.confirm(`确认取消 ${name} 的守护权限吗?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
     }).then(() => {
-        console.log('item', item);
-        VE_API.manage_user.cleanBind({ miniUserId: item.miniUserId }).then(({ code }) => {
+        VE_API.manage_interface.cancelBindSample({ id }).then(({ code }) => {
             if (code === 0) {
-                ElMessage.success(`已取消 ${item.name} 的守护权限`);
+                ElMessage.success(`已取消 ${name} 的守护权限`);
                 getUserList();
+                emit("update:userList")
             }
         });
         // VE_API.manage_user.deleteUser({
@@ -192,6 +199,8 @@ watch(
     }
 );
 
+const emit = defineEmits(["update:userList"])
+
 </script>
 
 <style lang="scss" scoped>

+ 9 - 6
src/views/home/components/clientList.vue

@@ -83,6 +83,12 @@ import { Collapse, CollapseItem, Checkbox, Popup } from "vant";
 import EditClientPopup from "@/components/editClientPopup.vue";
 import { useRouter } from "vue-router";
 const router = useRouter();
+
+import { useStore } from "vuex";
+const store = useStore();
+
+const currentFarmId = store.getters.userinfo.curFarmId
+
 const props = defineProps({
     // 是否显示选择客户
     checkDistributeShow: {
@@ -130,16 +136,12 @@ const handleGlobalCheckAllChange = (val) => {
     });
 };
 
-function toCustomOneTree(data) {
-    router.push("/layout/customTree?type=single&data=" + JSON.stringify(data));
-}
-
 onMounted(() => {
     getUserList();
 });
 
 function getUserList() {
-    VE_API.manage_interface.fetchGroupList({ farmId: 766, isAllot: 0 }).then(({ data }) => {
+    VE_API.manage_interface.fetchGroupList({ farmId: currentFarmId, isAllot: 0 }).then(({ data, extData }) => {
         // defalutList.value = data
         groupList.value = Object.keys(data)
             .filter(key => data[key] && data[key].length > 0) // 先过滤掉空的 key
@@ -147,6 +149,7 @@ function getUserList() {
                 name: key,
                 list: data[key]
             }));
+        emit("update:listCount", extData.count)
         initGroupCheckStates(); // 初始化分组选择状态
     });
 }
@@ -228,7 +231,7 @@ watch(
     }
 );
 
-const emit = defineEmits(["update:checkDistributeShow", "update:checkData"]);
+const emit = defineEmits(["update:checkDistributeShow", "update:checkData", "update:listCount"]);
 </script>
 
 <style lang="scss" scoped>

+ 0 - 5
src/views/home/components/homePage.vue

@@ -156,11 +156,6 @@ const growObj = ref({});
 //生态指标
 const ecologyObj = ref({});
 
-const gybg = () => {
-    VE_API.farm_files.last({ farmId: 766, key: "pdf_report" }).then(({ data }) => {
-        eventBus.emit("homePage:gybg", { filename: data.path, title: "果园报告" });
-    });
-};
 </script>
 
 <style lang="scss" scoped>

+ 12 - 7
src/views/home/components/leftTabs/imgManage.vue

@@ -31,12 +31,12 @@
                     lbum-carousel-item
                     :key="index"
                     :name="item.code"
-                    :farmId="766"
+                    :farmId="currentFarmId"
                     :images="[item]"
                     :lock="false"
                 ></album-carousel-item>
             </div>
-            <div class="no-photo" v-show="!imageList.length">暂无数据</div>
+            <div class="no-photo" v-show="!imageList || !imageList.length">暂无数据</div>
         </div>
         <div class="pagination-wrap">
             <el-pagination
@@ -55,7 +55,11 @@
 <script setup>
 import { onMounted, onUnmounted, ref } from "vue";
 import albumCarouselItem from "../../album_compoents/albumCarouselItem.vue";
-import config from "@/api/config";
+
+import { useStore } from "vuex";
+const store = useStore();
+
+const currentFarmId = store.getters.userinfo.curFarmId
 const resize = "?imageView/1/w/240/h/240";
 
 function getCurrentMonth() {
@@ -68,7 +72,7 @@ const dateTime = ref(getCurrentMonth());
 const changeDate = () => {
     geImgaeList();
 };
-const areaValue = ref(2); // 默认区域ID
+const areaValue = ref(null); // 默认区域ID
 
 const areaOptions = ref([]);
 const currentPage = ref(1);
@@ -77,7 +81,7 @@ const totalVal = ref(0);
 
 const imageList = ref([]);
 const geImgaeList = () => {
-    VE_API.manage_interface.fetchGardenImgs({ date: dateTime.value, organId: 766, areaId: areaValue.value, limit: pageSize.value, page: currentPage.value }).then((res) => {
+    VE_API.manage_interface.fetchGardenImgs({ date: dateTime.value, organId: currentFarmId, areaId: areaValue.value, limit: pageSize.value, page: currentPage.value - 1 }).then((res) => {
         imageList.value = res.data;
         totalVal.value = res.count;
     });
@@ -89,13 +93,14 @@ function changeArea() {
 }
 
 onMounted(() => {
-    geImgaeList();
     getBlueRegionList()
 });
 
 function getBlueRegionList() {
-    VE_API.manage_interface.fetchRegionList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.fetchRegionList({ farmId: currentFarmId }).then(({ data }) => {
         areaOptions.value = data;
+        areaValue.value = data[0].id
+        geImgaeList();
     });
 }
 

+ 5 - 1
src/views/home/components/leftTabs/recordsManage.vue

@@ -130,6 +130,10 @@ import upload from "@/components/common/upload.vue";
 import eventBus from "@/api/eventBus";
 import editRecord from "./editRecord.vue";
 
+import { useStore } from "vuex";
+const store = useStore();
+
+const currentFarmId = store.getters.userinfo.curFarmId
 const disabledDate = (time) => {
     return time.getTime() > Date.now();
 };
@@ -219,7 +223,7 @@ onMounted(() => {
 });
 
 function getData() {
-    VE_API.home.getFarmBuyAutoList({ farmId: 766 }).then(({ data }) => {
+    VE_API.home.getFarmBuyAutoList({ farmId: currentFarmId }).then(({ data }) => {
         farmWorkList.value = data;
     });
 }

+ 6 - 25
src/views/home/homeMap.vue

@@ -36,6 +36,9 @@ let listenKey = null;
 let regionLayer = null;
 let clusterSource = null;
 
+const currentFarmId = store.getters.userinfo.curFarmId
+// const currentFarmId = sessionStorage.getItem('userinfo').curFarmId
+
 // 样式缓存优化
 // 样式缓存优化 - 确保所有样式都正确初始化
 const styleCache = {
@@ -202,7 +205,7 @@ const saveSelect = (callback) => {
     const params = {
         sampleIds,
         isRenyang: 1,
-        farmId: Number(sessionStorage.getItem("currentFarmId"))
+        farmId: currentFarmId
     };
     
     VE_API.manage_interface.batchOpenOrCloseSample(params).then(() => {// 保存成功后刷新数据
@@ -210,26 +213,6 @@ const saveSelect = (callback) => {
     });
 };
 
-// 保存选择--分配果树
-const saveDistributeSelect = (callback) => {
-    const sampleIds = [];
-    treeClusterLayer.layer.getSource().getSource().getFeatures().forEach(feature => {
-        if (feature.get("highlight")) {
-            sampleIds.push(feature.get("sampleId"));
-        }
-    });
-    
-    const params = {
-        sampleIds,
-        isRenyang: 1,
-        farmId: Number(sessionStorage.getItem("currentFarmId"))
-    };
-    
-    // VE_API.manage_interface.batchOpenOrCloseSample(params).then(() => {// 保存成功后刷新数据
-    //     callback?.();
-    // });
-};
-
 // 更新集群数据而不重新渲染整个图层
 const updateClusterData = (treeListData, distanceVal = 20) => {
     if (!treeListData || !Array.isArray(treeListData)) {
@@ -363,7 +346,6 @@ const refreshClusterStyle = () => {
     if (treeClusterLayer) {
         treeClusterLayer.layer.getSource().refresh();
     }
-    console.log('geteget');
     if (isDrawing.value) {
         const sampleIds = [];
         treeClusterLayer.layer.getSource().getSource().getFeatures().forEach(feature => {
@@ -412,7 +394,7 @@ const handleClusterClick = (features) => {
 // 处理单个要素点击
 const handleSingleFeatureClick = (feature) => {
     if (isDrawing.value) {
-        feature.set("highlight", true);
+        feature.set("highlight", !feature.get("highlight"));
         refreshClusterStyle();
     } else {
         resetCurrentTree();
@@ -420,7 +402,7 @@ const handleSingleFeatureClick = (feature) => {
         currentTree.value = feature;
         
         eventBus.emit("click:point", { 
-            farmId: Number(sessionStorage.getItem("currentFarmId")), 
+            farmId: currentFarmId, 
             sampleId: feature.get("sampleId"), 
             data: feature.getProperties() 
         });
@@ -464,7 +446,6 @@ defineExpose({
     initAreaMap, 
     resetCurrentTree, 
     saveSelect,
-    saveDistributeSelect,
     refreshClusterStyle // 暴露刷新方法
 });
 

+ 36 - 15
src/views/home/index.vue

@@ -14,11 +14,18 @@
                                 <adopt-list></adopt-list>
                             </el-tab-pane>
                             <el-tab-pane label="待分配" name="待分配">
+                                <template #label>
+                                    <span class="custom-tabs-label">
+                                        <span>待分配</span>
+                                        <span class="count-text" v-if="listCount">{{ listCount }}</span>
+                                    </span>
+                                </template>
                                 <client-list
                                     :checkDistributeShow="checkDistributeShow"
                                     :startReloadList="startReloadList"
                                     @update:checkDistributeShow="hanldeDistributeCheck"
                                     @update:checkData="handlCheckChange"
+                                    @update:listCount="updateListCount"
                                     ></client-list>
                             </el-tab-pane>
                             <el-tab-pane label="已分配" name="已分配">
@@ -127,11 +134,13 @@ const mapRef = ref(null);
 
 const activeName = ref("果树列表");
 
+const currentFarmId = store.getters.userinfo.curFarmId
+// const currentFarmId = sessionStorage.getItem('userinfo').curFarmId
+
 onMounted(() => {
     //区域切换监听事件
     eventBus.on("area:id", areaId);
-    sessionStorage.setItem("currentFarmId", 766);
-    areaId({ areaId: 0, farmId: 766 });
+    areaId({ areaId: 0, farmId: currentFarmId });
 
     // 修改单棵树信息后刷新地图数据
     eventBus.off("refreshMapData", getPointList);
@@ -190,6 +199,11 @@ const handlCheckChange = (val) => {
     selectedTels.value = val;
 };
 
+const listCount = ref(null)
+function updateListCount(count) {
+    listCount.value = count
+}
+
 // 地图--选树时抛出的事件
 const selectedTree = ref([]);
 const handleSelectedTree = (data) => {
@@ -214,11 +228,14 @@ const saveEdit = () => {
 };
 
 const saveDistributeEdit = () => {
+    if (!selectedTree.value.length || !selectedTels.value.length || selectedTree.value.length < selectedTels.value.length) {
+        return
+    }
     // mapRef.value.saveDistributeSelect(() => {
     //     getPointList();
     // });
     const params = {
-        farmId: 766,
+        farmId: currentFarmId,
         sampleIds: selectedTree.value,
         tels: selectedTels.value,
     };
@@ -238,22 +255,11 @@ const legendArr = ref([]);
 
 const organId = ref("");
 const regionId = ref(null);
-const tabName = ref("");
-const tabId = ref(0);
 eventBus.off("changePointLegend", toggleLegend);
 eventBus.on("changePointLegend", toggleLegend);
 function toggleLegend({ colorObj }) {
     legendArr.value = colorObj?.list;
 }
-//选项卡事件监听
-const handleTab = async ({ name, id, isUpdate, params, legend, colorObj }) => {
-    eventBus.emit("changePointType", { legend, colorObj });
-    legendArr.value = colorObj?.list;
-    tabName.value = name;
-    tabId.value = id;
-    // if (id === 0) {
-    // }
-};
 
 //区域切换监听事件
 function areaId({ areaId, farmId }) {
@@ -371,6 +377,22 @@ function setReload() {
                         height: 100%;
                     }
                 }
+                .custom-tabs-label {
+                    position: relative;
+                    .count-text {
+                        position: absolute;
+                        top: -7px;
+                        right: -20px;
+                        width: 16px;
+                        height: 16px;
+                        background: #E04C4C;
+                        color: #fff;
+                        text-align: center;
+                        line-height: 16px;
+                        border-radius: 50%;
+                        font-size: 10px;
+                    }
+                }
             }
             .list {
                 width: 100%;
@@ -501,7 +523,6 @@ function setReload() {
             .disabled {
                 opacity: 0.6;
                 pointer-events: none;
-                cursor: not-allowed;
             }
         }
         .select-text {

+ 6 - 10
src/views/settingTree/index.vue

@@ -110,7 +110,6 @@
                     <div class="setting-item">
                         <span class="edit-label">树龄:</span>
                         <el-input-number
-                            @change="settingSinglePrice"
                             class="number-input"
                             :controls="false"
                             placeholder="请输入树龄"
@@ -169,6 +168,7 @@ import { useStore } from "vuex";
 import { ElMessage } from "element-plus";
 let store = useStore();
 
+const currentFarmId = store.getters.userinfo.curFarmId
 const areaVal = ref(0);
 const areaOptions = ref([]);
 const typeVal = ref(0);
@@ -197,7 +197,7 @@ function goBack() {
 onMounted(() => {
     getSamplePage();
 
-    VE_API.manage_interface.speciesList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.speciesList({ farmId: currentFarmId }).then(({ data }) => {
         speciesList.value = data;
     });
 
@@ -206,7 +206,7 @@ onMounted(() => {
 });
 
 function getBlueRegionList() {
-    VE_API.manage_interface.fetchRegionList({ farmId: 766 }).then(({ data }) => {
+    VE_API.manage_interface.fetchRegionList({ farmId: currentFarmId }).then(({ data }) => {
         areaOptions.value = data;
     });
 }
@@ -224,11 +224,11 @@ function handleTypeChange() {
 function getSamplePage() {
     VE_API.manage_interface
         .fetchSamplePage({
-            farmId: 766,
+            farmId: currentFarmId,
             regionId: areaVal.value === 0 ? null : areaVal.value,
             pz: typeVal.value ? typeVal.value : null,
             ageRange: ageVal.value === 0 ? null : [ageVal.value - 10, ageVal.value],
-            page: currentPage.value,
+            page: currentPage.value - 1,
             limit: pageSize.value,
         })
         .then(({ data, count }) => {
@@ -251,15 +251,11 @@ const plantDate = ref(null);
 
 const speciesList = ref([]);
 
-function settingSinglePrice() {
-    console.log("sss");
-}
-
 function settingForm() {
     const sampleIds = allTrees.value.map((item) => item.sampleId);
     const params = {
         sampleIds,
-        farmId: Number(sessionStorage.getItem("currentFarmId")),
+        farmId: currentFarmId,
         age: settingAge.value,
         pz: settingPz.value,
         plantDate: plantDate.value,

+ 5 - 18
src/views/user/index.vue

@@ -25,7 +25,7 @@
                     class="upload-demo"
                     :action="config.base_url + 'adm/import_lighten_card_offline'"
                     multiple
-                    :data="{ farmId: 766 }"
+                    :data="{ farmId: currentFarmId }"
                     :headers="uploadHeaders"
                     :on-success="handleUploadMsg"
                     :on-error="handleUploadMsg"
@@ -152,6 +152,7 @@ let store = useStore();
 import { useRouter } from "vue-router";
 import { dateFormat } from "@/utils/date_util";
 const router = useRouter();
+const currentFarmId = store.getters.userinfo.curFarmId
 
 const searchVal = ref(null);
 
@@ -163,11 +164,6 @@ const levelObj = {
     4: "星勋守护",
 };
 
-const statusObj = {
-    0: "未授权",
-    1: "待登录",
-    2: "待激活",
-};
 
 const tableData = ref([]);
 
@@ -175,15 +171,6 @@ const selectedRows = ref([]);
 function handleTableSelect(selection) {
     selectedRows.value = selection;
 }
-function handleMsg(row) {
-    console.log("row");
-}
-
-const cityVal = ref("广东省");
-const cityOptions = ref([
-    { label: "广东省", value: "广东省" },
-    { label: "湖北省", value: "湖北省" },
-]);
 
 const groupVal = ref('-2');
 const groupOptions = ref([]);
@@ -204,7 +191,7 @@ onMounted(() => {
     getGroupList();
 
     VE_API.manage_user
-        .fetchLevelList({farmId: 766})
+        .fetchLevelList({farmId: currentFarmId})
         .then(({ data }) => {
             levelOptions.value = data
         });
@@ -212,7 +199,7 @@ onMounted(() => {
 
 function getGroupList() {
     VE_API.manage_user
-        .fetchGroupList({farmId: 766})
+        .fetchGroupList({farmId: currentFarmId})
         .then(({ data }) => {
             groupOptions.value = data
         });
@@ -233,7 +220,7 @@ function handleSizeChange(newSize) {
 function getTableData() {
     // 获取数据
     VE_API.manage_interface
-        .fetchUserList({ farmId: 766, word: searchVal.value, level: (levelVal.value !== '-2') ? levelVal.value : null, groupId: (groupVal.value !== '-2') ? groupVal.value : null, page: currentPage.value, limit: pageSize.value })
+        .fetchUserList({ farmId: currentFarmId, word: searchVal.value, level: (levelVal.value !== '-2') ? levelVal.value : null, groupId: (groupVal.value !== '-2') ? groupVal.value : null, page: currentPage.value - 1, limit: pageSize.value })
         .then(({ data, count }) => {
             tableData.value = data;
             totalVal.value = count;