(() => {
Vue.component('uploadPointclound', {
props: [],
name: 'uploadPointclound',
template: `
{{item.title}}
数据集:{{item.id}}
添加到场景
已添加的数据集
-
{{i.sceneNum}}
来自场景:{{i.title}}
`,
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()
},
})
})();