Selaa lähdekoodia

feat:实例化接口

jinx 4 vuotta sitten
vanhempi
commit
9a32af4735
3 muutettua tiedostoa jossa 115 lisäystä ja 66 poistoa
  1. 56 31
      components/upload-Pointclound/index.js
  2. 47 35
      locat/addDataSet.html
  3. 12 0
      style.css

+ 56 - 31
components/upload-Pointclound/index.js

@@ -29,15 +29,15 @@
                     <p class="itemTitle">已添加的数据集 </p>
                     <div class="listBox">
                         <ul class="sceneList">
-                            <li class="sceneItem" v-for="i in 10">
+                            <li class="sceneItem" v-for="i in hasList">
                                 <div class="sceneName">
-                                    <p class="code">t-iksBApb</p>
-                                    <span class="name">来自场景:港2</span>
+                                    <p class="code">{{i.sceneNum}}</p>
+                                    <span class="name">来自场景:{{i.title}}</span>
                                 </div>
                                 <div class="scene_control">
                                    
 
-                                    <el-popconfirm placement="top" title="是否要删除该数据集?" :hide-icon="true" @confirm="delConfirm">
+                                    <el-popconfirm placement="top" title="是否要删除该数据集?" :hide-icon="true" @confirm="delConfirm(i.id)">
                                         <el-button class="delBtn" title="删除" slot="reference"></el-button>
                                     </el-popconfirm>
                                     <!-- <div class="delBtn" title="删除"></div> -->
@@ -50,33 +50,14 @@
         data() {
             return {
                 dataList: [],
-                options: [{
-                    id: 1,
-                    name: "港2",
-                }, {
-                    id: 2,
-                    name: "港2",
-                }, {
-                    id: 3,
-                    name: "港2",
-                }, {
-                    id: 4,
-                    name: "港2",
-                }, {
-                    id: 5,
-                    name: "港2",
-                }, {
-                    id: 6,
-                    title: "港2",
-                }],
+                options: [],
+                hasList: [],
                 value: '',
             }
         },
         methods: {
 
             getSceneData() {
-
-
                 let params = {
                     "pageNum": 0,
                     "pageSize": 999,
@@ -84,11 +65,8 @@
                 }
 
                 axios({
-                    headers: {
-                        'X-Authorization': this.$parent.token
-                    },
-                    method: 'post',
                     url: '/indoor/scene/list',
+                    method: 'post',
                     data: params
                 }).then(res => {
                     console.log(res)
@@ -98,6 +76,18 @@
 
                 })
             },
+            getHasSceneList() {
+                axios({
+                    url: `/indoor/${sceneNum}/api/merge/exist`,
+                    method: 'get',
+                }).then(res => {
+                    if (res.data.code == 0) {
+                        this.hasList = res.data.data
+                    }
+                }).catch(err => {
+
+                })
+            },
             searchScene(e) {
                 console.log(e)
                 let res = this.dataList.filter(i => {
@@ -113,11 +103,28 @@
                 // 
 
                 this.$parent.showLoading('上传中...')
+                let res = this.hasList.filter(i => {
+                    console.log(i.sceneNum)
+                    if (this.value == i.sceneNum) {
+                        return i
+                    }
+                })
+                if (res.length > 0) {
+                    this.$parent.hideLoading()
+                    this.$message({
+                        message: '请勿重复添加数据集',
+                        type: 'error',
+                        duration: 2000,
+                    });
+                    return
+
+                }
 
                 axios.post(`/indoor/${sceneNum}/api/merge/${this.value}`).then(res => {
                     this.$parent.hideLoading()
                     this.value = ''
                     if (res.data.code == 0) {
+                        this.getHasSceneList()
                         this.$message({
                             message: '数据集添加成功',
                             type: 'success',
@@ -145,8 +152,24 @@
 
 
             },
-            delConfirm() {
-                console.log(1)
+            delConfirm(id) {
+                axios({
+                    // url: `/indoor/${sceneNum}/api/merge/exist`,
+                    url: `/indoor/${sceneNum}/api/merge/remove/${id}`,
+                    method: 'get',
+                }).then(res => {
+                    if (res.data.code == 0) {
+                        this.getHasSceneList()
+                        this.$message({
+                            message: '数据集删除成功',
+                            type: 'success',
+                            duration: 2000,
+                        });
+                        IV.api.AuthenticationService.sendAuthenticationChanged()
+                    }
+                }).catch(err => {
+
+                })
             },
             back() {
                 this.$parent.showType = 0
@@ -166,7 +189,9 @@
             // function openMap() {
             //     IV.swapScenes()
             // }
+
             this.getSceneData()
+            this.getHasSceneList()
         },
     })
 })();

+ 47 - 35
locat/addDataSet.html

@@ -43,9 +43,9 @@
                         添加数据集
                     </div>
 
-                    <div class="editBtn pointClound" @click="showType=3">
+                    <!-- <div class="editBtn pointClound" @click="showType=3">
                         平面图
-                    </div>
+                    </div> -->
 
 
 
@@ -198,12 +198,17 @@
                     <div class="defaultPic itemBox active">
                         <div class="ctrlBox">
                             <p class="ctrlTitle">默认平面图</p>
-                            <div class="ctrlBtn">
-                                <i class="ctrlIcon refreshIcon"></i>
-                                <p class="ctrlText">更新</p>
-                                <div class="tipBox" title="修改点云或数据集后,请更新平面图"></div>
+                            <el-popconfirm placement="top" title="系统将创建新的平面图,您上传的平面图将被清除,是否继续?" :hide-icon="true" @confirm="refreshConfirm">
+                                <el-button slot="reference">
+                                    <div class="ctrlBtn">
+                                        <i class="ctrlIcon refreshIcon"></i>
+                                        <p class="ctrlText">更新</p>
+                                        <!-- <div class="tipBox" title="修改点云或数据集后,请更新平面图"></div> -->
+
+                                    </div>
+                                </el-button>
+                            </el-popconfirm>
 
-                            </div>
                         </div>
 
                     </div>
@@ -212,11 +217,16 @@
 
                             <p class="ctrlTitle">自定义平面图</p>
                             <div class="btnBox">
-                                <div class="ctrlBtn">
-                                    <i class="ctrlIcon disableIcon "></i>
-                                    <p class="ctrlText">删除</p>
+                                <el-popconfirm placement="top" title="确认删除?" :hide-icon="true" @confirm="delConfirm">
+                                    <el-button slot="reference">
+                                        <div class="ctrlBtn">
+                                            <i class="ctrlIcon disableIcon "></i>
+                                            <p class="ctrlText">删除</p>
+
+                                        </div>
+                                    </el-button>
+                                </el-popconfirm>
 
-                                </div>
                                 <div class="ctrlBtn">
                                     <i class="ctrlIcon downloadIcon"></i>
                                     <p class="ctrlText">下载</p>
@@ -359,7 +369,8 @@
                 const origin = window.location.origin + window.location.pathname
                 const tokenKry = 'ls.' + origin + '#JWT'
                 this.token = localStorage.getItem(tokenKry)
-                    // alert(sceneNum)
+                axios.defaults.headers.common['X-Authorization'] = this.token;
+                // alert(sceneNum)
                 this.getContorlPoint()
                     // this.sceneNum = window.location.pathname.split('/')[2]
                     // this.$nextTick(() => {
@@ -494,35 +505,31 @@
 
                 commit() {
                     this.handleData()
-                    Promise.all([
-                        axios.post('/indoor/' + sceneNum + '/api/controlPoint/save', {
-                            ageControlLocation1: this.ageControlLocation1,
-                            ageControlLocation2: this.ageControlLocation2,
-                            gpsControlCoordinate1: this.gpsControlCoordinate1,
-                            gpsControlCoordinate2: this.gpsControlCoordinate2,
-                            sceneNum: sceneNum,
-                            // id: 1
-                        })
-                        .catch(function(error) {
+                    this.showLoading('请稍后...')
+                    axios.post('/indoor/' + sceneNum + '/api/controlPoint/save', {
+                        ageControlLocation1: this.ageControlLocation1,
+                        ageControlLocation2: this.ageControlLocation2,
+                        gpsControlCoordinate1: this.gpsControlCoordinate1,
+                        gpsControlCoordinate2: this.gpsControlCoordinate2,
+                    }).then((res) => {
+                        if (res.data.code == 0) {
+                            IV.api.AuthenticationService.sendAuthenticationChanged()
+                            this.getContorlPoint()
+                            this.hideLoading()
                             this.$message({
-                                message: '控制点上传失败',
-                                type: 'error',
+                                message: '控制点上传成功',
+                                type: 'success',
                                 duration: 2000,
                             });
-                        }),
+                        }
 
-                        // this.getImageTransform()
-                        // .catch(_ => {
-                        //     alert('地图数据上传失败')
-                        // })
-                    ]).then(() => {
-                        this.getContorlPoint()
+                    }).catch(function(error) {
+                        this.hideLoading()
                         this.$message({
-                            message: '控制点上传成功',
-                            type: 'success',
+                            message: '控制点上传失败',
+                            type: 'error',
                             duration: 2000,
                         });
-                        // alert('控制点上传成功')
                     })
 
                 },
@@ -622,7 +629,12 @@
                         obj.selectionStart = obj.selectionEnd = len;
                     }
                 },
-
+                refreshConfirm() {
+                    console.log('refreshConfirm')
+                },
+                delConfirm() {
+                    console.log('delConfirm')
+                }
 
 
 

+ 12 - 0
style.css

@@ -831,6 +831,13 @@ input::-webkit-input-placeholder {
     margin-right: 10px;
 }
 
+.ctrlBox .el-button {
+    border: none;
+    background: transparent;
+    padding: 0;
+    line-height: normal;
+}
+
 .ctrlBtn.none {
     border: 1px solid #cdcdcd;
 }
@@ -908,4 +915,9 @@ input::-webkit-input-placeholder {
     background: #000;
     margin-top: 10px;
     border-radius: 4px;
+}
+
+.el-popconfirm__main {
+    max-width: 220px;
+    font-size: 14px;
 }