123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- (() => {
- Vue.component('uploadPointclound', {
- props: [],
- name: 'uploadPointclound',
- template: `<div id="uploadBox" >
- <div class="headerBack">
- <div class="topBox">
- <i class="backIcon" @click="back"></i>
- <p class="headerTitle">添加数据集</p>
- </div>
- </div>
-
- <div class="selectBox">
- <el-select v-model="value" filterable @click.native="options = dataList" :filter-method="searchScene" placeholder="请选择">
- <el-option v-for="item in options" :key="item.id" :label="item.title" :value="item.id">
- <div class="sceneName">
- <p class="code">{{item.title}}</p>
- <span class="name">数据集:{{item.id}}</span>
- </div>
- </el-option>
- </el-select>
- </div>
- <div class="uploadBtn" @click="openUpload" :class="{disabled:value==''}">
- <i class="fa fa-plus ng-scope"></i> 添加到场景
- </div>
- <p class="itemTitle">已添加的数据集 </p>
- <div class="listBox">
- <ul class="sceneList">
- <li class="sceneItem" v-for="i in hasList">
- <div class="sceneName">
- <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(i.id)">
- <el-button class="delBtn" title="删除" slot="reference"></el-button>
- </el-popconfirm>
- <!-- <div class="delBtn" title="删除"></div> -->
- </div>
- </li>
- </ul>
- </div>
- </div>`,
- data() {
- return {
- dataList: [],
- options: [],
- hasList: [],
- value: '',
- }
- },
- methods: {
- getSceneData() {
- let params = {
- "pageNum": 0,
- "pageSize": 999,
- "searchKey": "",
- }
- axios({
- url: '/indoor/scene/list',
- method: 'post',
- data: params
- }).then(res => {
- console.log(res)
- this.dataList = res.data.data.content
- this.options = res.data.data.content
- }).catch(err => {
- })
- },
- 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 => {
- if (i.id.indexOf(e) != -1 || i.title.indexOf(e) != -1) {
- return i
- }
- })
- console.log(res)
- this.options = res
- },
- openUpload() {
- //
- 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',
- duration: 2000,
- });
- IV.api.AuthenticationService.sendAuthenticationChanged()
- } else {
- this.$message({
- message: '数据集添加失败',
- type: 'error',
- duration: 2000,
- });
- }
- }).catch(err => {
- this.value = ''
- this.$parent.hideLoading()
- this.$message({
- message: '数据集添加失败',
- type: 'error',
- duration: 2000,
- });
- })
- },
- 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
- }
- },
- computed: {
- },
- destroyed() {
- },
- mounted() {
- // window.eventBus.off('openMap', openMap);
- // window.eventBus.on('openMap', openMap);
- // function openMap() {
- // IV.swapScenes()
- // }
- this.getSceneData()
- this.getHasSceneList()
- },
- })
- })();
|