diff --git a/src/config/mork.js b/src/config/mork.js index d1c69f5..92f0781 100644 --- a/src/config/mork.js +++ b/src/config/mork.js @@ -114,8 +114,8 @@ export const getMappingStatus = () => { let res = { code: 200, message: 'ok', - mapping_return: '2', - mapping_percent: '100' + mapping_return: '1', + mapping_percent: '50' } return res } diff --git a/src/pages/modules/building.vue b/src/pages/modules/building.vue index 797d82f..3a61625 100644 --- a/src/pages/modules/building.vue +++ b/src/pages/modules/building.vue @@ -32,9 +32,11 @@
- {{warnTip ? '正在部署地图中...' : '正在生成地图中...'}}
+
@@ -114,6 +116,7 @@ export default { preventClickEvent: false }, showProgress: false, + warnTip: false, percentage: 0, intervalId: null // 用于存储定时器ID } @@ -199,7 +202,7 @@ export default { addPoint () { this.dialogVisible = true this.dataForm.stationCode = 'B' + (this.keyPoints.length + 1) - this.dataForm.stationName = 'B' + (this.keyPoints.length + 1) + this.dataForm.stationName = '工作点' + (this.keyPoints.length + 1) }, // 打点->保存 async _setStation () { @@ -258,39 +261,36 @@ export default { async _getMappingStatus () { try { let res = await getMappingStatus() - if (res && res.code === 200) { - this.showProgress = true - this.percentage = Number(res.mapping_percent) || 0 - if (res.mapping_return === '0') { - if (this.intervalId) clearTimeout(this.intervalId) - this.intervalId = setTimeout(() => this._getMappingStatus(), 1000) - } - if (res.mapping_return === '1') { - if (this.intervalId) clearTimeout(this.intervalId) - this.showProgress = false - this.percentage = 0 - this._oneClickDeployment() - } - if (res.mapping_return === '2') { - if (this.intervalId) clearTimeout(this.intervalId) - this.showProgress = false - this.percentage = 0 - this.keyPoints = [] - this.$confirm('新建地图失败, 是否重新建图?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this._startMapping() - }).catch(() => { - this.$message({ - type: 'info', - message: '已取消建图' - }) - }) - } + this.showProgress = true + this.percentage = Number(res.mapping_percent) || 0 + if (res.mapping_return === '0') { + if (this.intervalId) clearTimeout(this.intervalId) + this.intervalId = setTimeout(() => this._getMappingStatus(), 1000) + } + if (res.mapping_return === '1') { + if (this.intervalId) clearTimeout(this.intervalId) + this.warnTip = true + this.percentage = 0 + this._oneClickDeployment() + } + if (res.mapping_return === '2') { + if (this.intervalId) clearTimeout(this.intervalId) + this.showProgress = false + this.percentage = 0 + this.keyPoints = [] + this.$confirm('新建地图失败, 是否重新建图?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this._startMapping() + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消建图' + }) + }) } - this.loading.close() } catch (e) { this.message = '' this.error = false @@ -322,11 +322,15 @@ export default { } else { this.$message.error(res.message) } + this.showProgress = false + this.warnTip = false this.message = '' this.error = false this.disabled = false this.loading.close() } catch (e) { + this.showProgress = false + this.warnTip = false this.$message.error(e) this.message = '' this.error = false @@ -381,4 +385,10 @@ export default { text-align: center; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); } +.progress_tip { + font-size: .2rem + line-height: .34rem + color: #000 + font-weight: 700 +} diff --git a/src/style/common.styl b/src/style/common.styl index 2ffad3f..11f5eea 100644 --- a/src/style/common.styl +++ b/src/style/common.styl @@ -218,6 +218,8 @@ color #17ff09 .el-progress-bar__inner,.el-progress-bar__outer border-radius 0 +.el-progress__text + font-size .2rem !important // button .button_control