(() => { Vue.component('uploadTitlemap', { props: [], name: 'uploadTitlemap', template: `

平面图

默认平面图

重新生成

自定义平面图

下载

操作说明
1. 下载默认平面图,支持.png文件下载;
2. 解压下载的压缩包,替换压缩包中的图片文件;
(文件名,图片大小、格式需与原图保持一致)
3. 上传平面图
`, //删除 // // //
// //

删除

//
//
//
data() { return { showMapPic: false, info: {}, type: -1, downloadUrl: 'https://laser.4dkankan.com/' } }, methods: { downloadMap() { axios.get(`/indoor/${sceneNum}/api/tiled_maps/download`).then(res => { console.log(this.downloadUrl + res.data.msg) if (res.data.code == 0) { window.location.href = this.downloadUrl + res.data.msg } else { this.$message({ message: res.data.msg, type: 'error', duration: 2000, }); } }).catch(err => { this.$message({ message: err.data.msg, type: 'error', duration: 2000, }); }) }, refreshConfirm() { this.$parent.showLoading('更新中...') axios.get(`/indoor/${sceneNum}/api/tiled_maps/init`).then(res => { // this.$parent.hideLoading() if (res.data.code == 0) { this.getDetaile() IV.api.AuthenticationService.sendAuthenticationChanged() } else { this.$parent.hideLoading() this.$message({ message: res.data.msg, type: 'error', duration: 2000, }); } }).catch(err => { this.$parent.hideLoading() this.$message({ message: err.data.msg, type: 'error', duration: 2000, }); }) }, changeDisplay(val) { console.log(val) if (val) { this.info.display = 1 } else { this.info.display = 0 } this.$parent.showLoading('切换中...') axios.get(`/indoor/${sceneNum}/api/tiled_maps/updateDisplay/${this.info.display}`).then(res => { if (res.data.code == 0) { IV.api.AuthenticationService.sendAuthenticationChanged() } else { this.$parent.hideLoading() this.$message({ message: res.data.msg, type: 'error', duration: 2000, }); } }).catch(err => { this.$parent.hideLoading() this.$message({ message: err.data.msg, type: 'error', duration: 2000, }); }) }, delConfirm() { console.log('delConfirm') }, isZip(file) { return /\.(zip)$/.test(file.name) }, uploadPic(e) { let file = e.target.files[0] console.log(file) if (!this.isZip(file)) { this.$message({ message: '请上传zip格式', type: 'error', duration: 2000, }); return } let params = new FormData() params.append('file', file) this.$parent.showLoading('上传中...') axios.post(`/indoor/${sceneNum}/api/tiled_maps/upload`, params).then(res => { let file = this.$refs.files file.value = '' if (res.data.code == 0) { this.$message({ message: '上传成功', type: 'success', duration: 2000, }); this.getDetaile() IV.api.AuthenticationService.sendAuthenticationChanged() } else { this.$parent.hideLoading() this.$message({ message: res.data.msg, type: 'error', duration: 2000, }); } }).catch(err => { let file = this.$refs.file file.value = '' this.$parent.hideLoading() this.$message({ message: err.data.msg, type: 'error', duration: 2000, }); }) }, back() { this.$parent.showType = 0 }, getDetaile() { axios.get(`/indoor/${sceneNum}/api/tiled_maps/detail`).then(res => { if (res.data.code == 0) { console.log(res.data.data) this.info = res.data.data this.type = this.info.status || 0 if (this.info.display) { this.showMapPic = true } else { this.showMapPic = false } } else { this.$message({ message: res.data.msg, type: 'error', duration: 1000, }); } }).catch(err => { this.$message({ message: err.data.msg, type: 'error', duration: 1000, }); }) }, openMap() { this.$parent.hideLoading() if (IV.getMainView().ViewService.primaryView != 'map') { IV.swapScenes() } } }, computed: { }, destroyed() { if (IV.getMainView().ViewService.primaryView == 'map') { IV.swapScenes() } }, mounted() { this.openMap() window.eventBus.off('openMap', this.openMap); window.eventBus.on('openMap', this.openMap); // function openMap() { // this.$parent.hideLoading() // if (IV.getMainView().ViewService.primaryView != 'map') { // IV.swapScenes() // } // } this.getDetaile() }, }) })();