Quellcode durchsuchen

fix: 对接接口

lxf vor 6 Stunden
Ursprung
Commit
330d126e39

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

@@ -0,0 +1,21 @@
+const config = require("../config")
+
+module.exports = {
+    offlineTakeList: {
+        url: config.base_url + "adm/offlineTakeList",
+        type: "get",
+    },
+    fetchSampleList: {
+        url: config.base_url + "adm/sampleList",
+        type: "get",
+    },
+    fetchSamplePage: {
+        url: config.base_url + "adm/samplePage/{page}/{limit}",
+        type: "post",
+    },
+    fetchRegionList: {
+        url: config.base_url + "adm/regionList",
+        type: "post",
+    },
+    
+}

+ 2 - 2
src/views/home/album_compoents/albumCarousel.vue

@@ -1,7 +1,7 @@
 <template>
     <el-dialog
         v-model="dialogVisible"
-        width="65%"
+        width="60%"
         align-center
         class="picture-preview-wrap v-dialog"
         :show-close="false"
@@ -157,7 +157,7 @@ eventBus.on("click:point", handleClickPoint);
 function handleClickPoint({ farmId, sampleId, data }) {
     console.log("click:point");
     sampleId = data.id;
-    getSampleFiles(data.geoHashSample);
+    data.geoHashSample && getSampleFiles(data.geoHashSample);
     photoBaseData.value[0].value = data.pz;
     isLoadingImg.value = true;
     let startDate = new Date(currentDate);

+ 43 - 25
src/views/home/components/adoptList.vue

@@ -69,15 +69,15 @@
             <div class="list-item" v-for="(item, index) in adoptList" :key="index">
                 <div class="list-info">
                     <div class="tree-icon">
-                        <div class="tree-tag" v-show="item.status === 0">未守护</div>
-                        <div class="tree-tag wait" v-show="item.status === 1">已守护</div>
+                        <div class="tree-tag" v-show="!item.offlineTakeSelected">未守护</div>
+                        <div class="tree-tag wait" v-show="item.offlineTakeSelected">已守护</div>
                         <!-- <img class="tree-img" src="@/assets/images/foster-home/tree-item.png" alt="" /> -->
-                        <img class="tree-img" :src="require(`@/assets/images/foster-home/list/${index < 7 ? index : 0}.png`)" alt="" />
-                        <div class="tree-type-name-tag">白糖罂</div>
+                        <img class="tree-img" :src="item.icon || require(`@/assets/images/foster-home/list/1.png`)" alt="" />
+                        <div class="tree-type-name-tag">{{ item.pz }}</div>
                     </div>
                     <div class="item-center">
                         <div class="center-t">
-                            {{item.bm ? item.bm : "BTY-A3"+index}}
+                            {{item.fosterCode}}
                             <!-- <span class="type-tag">综合:{{item.zh||94}}分</span>
                             <span class="type-tag">生态:{{item.st||92}}分</span> -->
                         </div>
@@ -92,13 +92,13 @@
                         <div class="center-item p-t-2 age-line" v-show="!isManySetting && !item.settingPrice">
                             <div class="age-wrap">
                                 <div class="has-age">
-                                    <div class="age">栽种时间:<span class="unit">{{ item.time }}</span></div>
+                                    <div class="age">栽种时间:<span class="unit">{{ item.time || '--' }}</span></div>
                                 </div>
                                 <div class="sort-line"></div>
                             </div>
-                            树龄:<span class="unit"><span class="unit">{{item.age||12}}年</span></span>
+                            树龄:<span class="unit"><span class="unit">{{item.age||'--'}}年</span></span>
                         </div>
-                        <div class="center-item" v-show="isManySetting && settingType !== 'age'"><span class="edit-label">树龄:</span><span class="unit">{{item.age||5}}年</span></div>
+                        <div class="center-item" v-show="isManySetting && settingType !== 'age'"><span class="edit-label">树龄:</span><span class="unit">{{item.age||'--'}}年</span></div>
                         <div class="center-item edit-item" v-show="isManySetting && settingType !== 'price'"><span class="edit-label">品种:</span><span class="unit">{{item.pz}}</span></div>
                         
                         <div class="center-item p-t-2 has-input edit-item" v-show="(isManySetting && settingType === 'price') || item.settingPrice">
@@ -147,6 +147,9 @@
                     <div class="btn edit-btn" @click="toSettingSinglePrice(index, false)">确认修改</div>
                 </div>
             </div>
+            <div class="pagination-wrap">
+                <el-pagination background :page-size="20" :pagerCount="5" v-model:current-page="currentPage" @current-change="getSamplePage" layout="prev, pager, next" :total="totalVal" />
+            </div>
         </div>
 
         <!-- 渐变主色按钮 -->
@@ -203,23 +206,23 @@ const statusOptions = ref([
     { label: "10-20年", value: 2 },
 ]);
 
-const adoptList = ref([
-    { status: 0, price: 10, bm: "BTY-A21", pz: "白糖罂", zh: 94, st: 92, sl: 5, total: 215, time: "2022.02.15", },
-    { status: 0, price: 12, bm: "BTY-A22", pz: "白糖罂", zh: 92, st: 94, sl: 6, total: 201, time: "2022.02.15" },
-    { status: 0, price: 8, bm: "BTY-A25", pz: "白糖罂", zh: 92, st: 94, sl: 4, total: 220, time: "2022.02.15" },
-    { status: 1, price: 13, bm: "BTY-A31", pz: "白糖罂", zh: 90, st: 92, sl: 6, total: 202, time: "2022.02.15" },
-    { status: 1, price: 10, bm: "BTY-A33", pz: "白糖罂", zh: 90, st: 96, sl: 7, total: 190, time: "2022.02.15" },
-    { status: 1, price: 16, time: "2022.02.15" },
-    { status: 1, price: 16, time: "2022.02.15" },
-    { status: 1, price: 16, time: "2022.02.15" },
-    { status: 1, price: 16, time: "2022.02.15" },
-]);
+const adoptList = ref([]);
 
 const owners = ref([{userName: "王丽丽", value: 50}])
 
-const displayedAdoptList = ref([...adoptList.value]); // 初始时显示完整列表
+onMounted(() => {
+    getSamplePage()
+});
 
-onMounted(() => {});
+const currentPage = ref(1)
+const totalVal = ref(0)
+
+function getSamplePage() {
+    VE_API.manage_interface.fetchSamplePage({farmId: 80865, page: currentPage.value, limit: 20}).then(({data, count}) => {
+        adoptList.value = data
+        totalVal.value = count
+    })
+}
 
 // 批量设置
 const batchAge = ref(null);
@@ -234,25 +237,23 @@ const settingTypeOptions = [
 const settingType = ref("age")
 function manySetPrice() {
     isManySetting.value = true;
-    displayedAdoptList.value = adoptList.value.filter((item) => item.status === 0);
 }
 function saveManySetting(isToSave) {
     isManySetting.value = false;
-    displayedAdoptList.value = [...adoptList.value]; // 显示完整列表
     if (isToSave) {
         // 保存
     }
 }
 
 function setManyPrice(v) {
-  displayedAdoptList.value.map(item => item.price = v)
+//   adoptList.value.map(item => item.price = v)
 }
 
 // 设置单棵树单价
 
 function toSettingSinglePrice(i, val) {
   console.log('tototot');
-  displayedAdoptList.value[i].settingPrice = val
+  adoptList.value[i].settingPrice = val
 }
 function settingSinglePrice() {
   console.log('sss');
@@ -304,8 +305,25 @@ function settingSinglePrice() {
     .select-b {
         margin-top: 8px;
     }
+    .pagination-wrap {
+        position: absolute;
+        bottom: 0;
+        width: 100%;
+        text-align: right;
+        right: 0;
+        background: #fff;
+        padding: 12px;
+        box-shadow: 0px 0px 4px #ccc;
+        box-sizing: border-box;
+        ::v-deep {
+            .el-pagination {
+                justify-content: center;
+            }
+        }
+    }
     .list-wrap {
         padding: 12px 0;
+        margin-bottom: 60px;
         .list-item {
             background: rgba(120, 120, 120, 0.05);
             padding: 8px 16px 8px 10px;

+ 14 - 3
src/views/home/components/clientList.vue

@@ -10,8 +10,8 @@
                             <el-icon class="icon" @click.stop="handlePerson('edit')" color="#2199F8" size="16"
                                 ><Edit/></el-icon>
                         </div>
-                        <div><span class="item-title">电话:</span>19875236548</div>
-                        <div><span class="item-title">地址:</span>湖北省武汉市富里唱鑫园5023</div>
+                        <div><span class="item-title">电话:</span>{{ ele.tel }}</div>
+                        <div><span class="item-title">地址:</span>{{ ele.address || "湖北省武汉市富里唱鑫园5023" }}</div>
                     </div>
                     <div class="blue-btn">去分配</div>
                 </div>
@@ -55,7 +55,7 @@
 </template>
 
 <script setup>
-import { ref, reactive } from "vue";
+import { ref, reactive, onMounted } from "vue";
 import { Collapse, CollapseItem, Checkbox, Popup, showConfirmDialog } from "vant";
 import { useRouter } from "vue-router";
 import { ElMessage } from "element-plus";
@@ -129,6 +129,16 @@ const defalutList = ref([
 function toCustomPage() {
     router.push("/layout/customTree");
 }
+
+onMounted(() => {
+    getUserList()
+})
+
+function getUserList() {
+    VE_API.manage_interface.offlineTakeList({farmId: 766}).then(({data}) => {
+        defalutList.value = data
+    })
+}
 </script>
 
 <style lang="scss" scoped>
@@ -177,6 +187,7 @@ function toCustomPage() {
     .list-content {
         width: 100%;
         height: 100%;
+        overflow: auto;
         &.max-height {
             height: calc(100% - 50px - 55px);
         }

+ 36 - 12
src/views/home/homeMap.vue

@@ -9,6 +9,7 @@
 import * as KMap from "@/utils/ol-map/KMap";
 import * as util from "@/common/ol_common.js";
 import Icon from "ol/style/Icon";
+import Photo from "ol-ext/style/Photo";
 import DragBox from "ol/interaction/DragBox";
 import { platformModifierKeyOnly } from "ol/events/condition";
 import { newPoint } from "@/utils/map.js";
@@ -118,13 +119,17 @@ function addCluster(treeListData, distanceVal) {
     let features = [];
     // 根据状态加上对应的图标
     for (let item of treeListData) {
-        let point = newPoint(item);
-        features.push(point);
+        try {
+            item.wkt = item.geom
+            let point = newPoint(item);
+            features.push(point);
+        } catch (err) {
+            console.error('err', err)
+        }
     }
     const source = new VectorSource({
         features: features,
     });
-
     clusterSource = new Cluster({
         distance: distanceVal ? distanceVal : 20, // 集合范围
         // minDistance: 60,
@@ -186,9 +191,21 @@ function addCluster(treeListData, distanceVal) {
                 const imgIcon = featureOne.get('icon')
                 if (imgIcon) {
                     style = new Style({
-                        image: new Icon({
-                            src: require(`@/assets/images/map/owner${imgIcon}.png`),
-                            scale: 1,
+                        // image: new Icon({
+                        //     src: imgIcon,
+                        //     scale: 1,
+                        // }),
+                        image: new Photo({
+                            src: imgIcon,
+                            kind: "circle",
+                            radius: 22,
+                            shadow: 0,
+                            crop: false,
+                            displacement: [0, 0],
+                            stroke: new Stroke({
+                                width: 2,
+                                color: "#fff",
+                            }),
                         }),
                     });
                 }
@@ -233,11 +250,18 @@ function addCluster(treeListData, distanceVal) {
                     // 已认养--显示图标
                     if (imgIcon) {
                         style = new Style({
-                            image: new Icon({
-                                src: require("@/assets/images/map/owner1.png"),
-                                scale: 1,
-                            }),
-                            zIndex: 22,
+                            image: new Photo({
+                                src: imgIcon,
+                                kind: "circle",
+                                radius: 22,
+                                shadow: 0,
+                                crop: false,
+                                displacement: [0, 0],
+                                stroke: new Stroke({
+                                    width: 2,
+                                    color: "#fff",
+                                }),
+                            })
                         });
                     } else {
                         style = new Style({
@@ -299,11 +323,11 @@ function addCluster(treeListData, distanceVal) {
                         features[0].set("highlight", true);
                         // features[0].setStyle(selectedStyle)
                     } else if (!hasFeatures) {
-                        console.log('hasFeatures');
                         resetCurrentTree()
                         features[0].set("currentTree", true)
                         const fs = features[0]
                         currentTree.value = features[0]
+                        console.log('hasFeatures', fs);
                         eventBus.emit("click:point", { farmId: fs.get("farmId"), sampleId: fs.get("sampleId"), data: fs.getProperties() })
                         // eventBus.emit("clickMapPoint", features[0])
                     }

+ 2 - 26
src/views/home/index.vue

@@ -130,33 +130,9 @@ onUnmounted(() => {
 });
 
 const getPointList = () => {
-    let selectAll = undefined;
-    if (regionId.value === 0) {
-        selectAll = 1;
-    }
-    const areaId = selectAll ? undefined : regionId.value;
-    VE_API.variety.pointList({ farmId: organId.value, regionId: areaId, selectAll }).then(({ data }) => {
-        // const arr = data.map(item =>{
-        //     return{
-        //         ...item,
-        //         color: item.fosterStatus === 0 ? "transprent" : (item.fosterStatus === 1 ? "#EEEEEE" : (item.fosterStatus === 2 ? "#F0AC37" : "transprent")),
-        //         lnglat:convertPointToArray(item.point)
-        //     }
-        // })
+    VE_API.manage_interface.fetchSampleList({ farmId: organId.value }).then(({ data }) => {
         if (mapRef.value) {
             nextTick(() => {
-                data[0].icon = "1";
-                data[1].icon = "1";
-                data[10].icon = "2";
-                data[20].icon = "2";
-                data[30].icon = "2";
-                data[35].icon = "1";
-                data[40].icon = "1";
-                data[50].icon = "2";
-                // 设置前50个对象的fosterStatus为1
-                for (let i = 0; i < 50 && i < data.length; i++) {
-                    data[i].fosterStatus = 1;
-                }
                 mapRef.value.addCluster(data);
                 // mapRef.value.initData(arr)
                 // mapRef.value.initMap(arr, () =>  mapRef.value.getRegionList(organId.value))
@@ -167,7 +143,7 @@ const getPointList = () => {
 
 const regionData = ref([]);
 function getBlueRegionList() {
-    VE_API.region.list({ farmId: organId.value }).then(({ data }) => {
+    VE_API.manage_interface.fetchRegionList({ farmId: organId.value }).then(({ data }) => {
         regionData.value = data;
         mapRef.value.initAreaMap(data);
     });