2025-07-04 17:52:10 +08:00
|
|
|
|
<template>
|
2025-08-27 11:16:49 +08:00
|
|
|
|
<div class="page_container" :class="{'enClass': $i18n.locale === 'en-us'}">
|
2025-08-20 16:48:08 +08:00
|
|
|
|
<div id="v-step-1" class="map_container">
|
|
|
|
|
|
<gl-map ref="glMap"/>
|
|
|
|
|
|
</div>
|
2025-07-04 17:52:10 +08:00
|
|
|
|
<el-row type="flex" justify="space-between">
|
2025-08-27 11:16:49 +08:00
|
|
|
|
<el-col :span="10"><button id="v-step-2" class="button_control" :disabled="disabled" @click="addPoint"><p>{{$t('MarkPoint')}}</p></button></el-col>
|
2025-08-13 18:06:35 +08:00
|
|
|
|
<el-col :span="14">
|
|
|
|
|
|
<el-row type="flex" justify="end">
|
2025-08-27 11:16:49 +08:00
|
|
|
|
<button class="button_control" @click="$router.push('/index/home')"><p>{{$t('AbandonMapbuild')}}</p></button>
|
|
|
|
|
|
<button id="v-step-3" class="button_control" style="margin-left: 10px" :disabled="disabled" @click="stopMappingConfirm"><p>{{$t('FinishMapbuild')}}</p></button>
|
2025-08-13 18:06:35 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-col>
|
2025-07-16 10:49:07 +08:00
|
|
|
|
</el-row>
|
2025-07-14 09:28:21 +08:00
|
|
|
|
<el-dialog
|
2025-08-27 11:16:49 +08:00
|
|
|
|
:title="$t('SetUpStation')"
|
2025-07-14 09:28:21 +08:00
|
|
|
|
:visible.sync="dialogVisible"
|
2025-08-28 17:26:16 +08:00
|
|
|
|
:close-on-click-modal="false"
|
2025-08-29 23:08:05 +08:00
|
|
|
|
:close-on-press-escape="false"
|
2025-08-15 14:55:07 +08:00
|
|
|
|
width="55%">
|
2025-08-27 17:57:33 +08:00
|
|
|
|
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '' : '1.1rem'" size="mini">
|
2025-08-27 11:16:49 +08:00
|
|
|
|
<el-form-item :label="$t('StationName')" prop="stationName">
|
|
|
|
|
|
<el-input v-model="dataForm.stationName" id="stationName"></el-input>
|
2025-07-14 09:28:21 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
|
|
|
|
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col>
|
2025-08-27 17:57:33 +08:00
|
|
|
|
<el-col :span="7"><button class="button_control" @click="stationConfirm"><p>{{$t('Save')}}</p></button></el-col>
|
2025-07-14 09:28:21 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-dialog>
|
2025-08-05 16:30:59 +08:00
|
|
|
|
<transition name="custom-message" >
|
|
|
|
|
|
<div v-if="message" class="message" :style="{'top': isTop ? '.87rem' : '.57rem', 'color': error ? '#F56C6C' : '#67C23A'}">
|
|
|
|
|
|
<i :class="error ? 'el-icon-error' : 'el-icon-success'"></i>
|
2025-07-16 10:49:07 +08:00
|
|
|
|
<p>{{ message }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</transition>
|
2025-08-08 17:44:36 +08:00
|
|
|
|
<div v-if="showProgress" class="progress-mask">
|
|
|
|
|
|
<!-- 进度条内容区 -->
|
|
|
|
|
|
<div class="progress-container">
|
2025-08-27 11:16:49 +08:00
|
|
|
|
<div class="progress_tip">{{warnTip ? $t('Mapdeployed') : $t('Mapgenerated')}}</div>
|
2025-08-11 13:28:37 +08:00
|
|
|
|
<el-progress
|
|
|
|
|
|
v-show="!warnTip"
|
2025-08-08 17:44:36 +08:00
|
|
|
|
:percentage="percentage"
|
2025-08-11 13:28:37 +08:00
|
|
|
|
:stroke-width="10"
|
2025-08-08 17:44:36 +08:00
|
|
|
|
style="width: 300px;"
|
|
|
|
|
|
></el-progress>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-07-04 17:52:10 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-30 00:34:49 +08:00
|
|
|
|
import GlMap from './gl-map-4.vue'
|
2025-08-20 16:48:08 +08:00
|
|
|
|
import { driver } from 'driver.js'
|
|
|
|
|
|
import 'driver.js/dist/driver.css'
|
2025-08-28 17:26:16 +08:00
|
|
|
|
// import { startMapping } from '../../config/mork.js'
|
2025-08-08 17:44:36 +08:00
|
|
|
|
import { startMapping, stopMapping, getMappingStatus, setStation, oneClickDeployment, abandonMapping } from '../../config/getData.js'
|
2025-08-05 16:30:59 +08:00
|
|
|
|
import { mapGetters } from 'vuex'
|
2025-07-04 17:52:10 +08:00
|
|
|
|
export default {
|
2025-08-05 14:20:40 +08:00
|
|
|
|
name: 'ModuleBuilding',
|
|
|
|
|
|
components: {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
GlMap
|
2025-08-05 14:20:40 +08:00
|
|
|
|
},
|
2025-07-16 10:49:07 +08:00
|
|
|
|
beforeRouteLeave (to, from, next) {
|
2025-07-23 20:05:03 +08:00
|
|
|
|
if (this.needsConfirmation) {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.$confirm(this.$t('Doabandonmapattempt'), this.$t('Prompt'), {
|
|
|
|
|
|
confirmButtonText: this.$t('Confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('Cancel'),
|
2025-07-23 20:05:03 +08:00
|
|
|
|
type: 'warning'
|
2025-07-25 18:43:20 +08:00
|
|
|
|
}).then(async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 显示加载中状态
|
|
|
|
|
|
this.loading = this.$loading({
|
|
|
|
|
|
lock: true,
|
|
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.6)'
|
|
|
|
|
|
})
|
|
|
|
|
|
// 调用放弃建图接口
|
|
|
|
|
|
const res = await abandonMapping()
|
|
|
|
|
|
this.loading.close()
|
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
|
// 接口成功,允许离开页面
|
|
|
|
|
|
this.needsConfirmation = false // 标记无需再确认
|
|
|
|
|
|
next()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 接口返回失败,提示错误并阻止离开
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.$message.error(res.message)
|
2025-07-25 18:43:20 +08:00
|
|
|
|
next(false)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// 发生异常,提示错误并阻止离开
|
|
|
|
|
|
this.loading.close()
|
|
|
|
|
|
next(false)
|
|
|
|
|
|
}
|
2025-07-23 20:05:03 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
next(false) // 阻止离开
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
next()
|
|
|
|
|
|
}
|
2025-07-16 10:49:07 +08:00
|
|
|
|
},
|
2025-07-04 17:52:10 +08:00
|
|
|
|
data () {
|
2025-08-27 17:57:33 +08:00
|
|
|
|
const validateStationName = (rule, value, callback) => {
|
|
|
|
|
|
if (value && value.includes(',')) {
|
|
|
|
|
|
callback(new Error(this.$t('stationnotcommas')));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-04 17:52:10 +08:00
|
|
|
|
return {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
driver: null,
|
|
|
|
|
|
driverActive: true,
|
2025-07-23 20:05:03 +08:00
|
|
|
|
needsConfirmation: true,
|
2025-07-14 17:52:37 +08:00
|
|
|
|
mapName: '',
|
2025-07-14 09:28:21 +08:00
|
|
|
|
dialogVisible: false,
|
|
|
|
|
|
dataForm: {
|
2025-08-08 17:44:36 +08:00
|
|
|
|
stationCode: '',
|
|
|
|
|
|
stationName: ''
|
2025-07-14 09:28:21 +08:00
|
|
|
|
},
|
2025-08-27 17:57:33 +08:00
|
|
|
|
dataRule: {
|
|
|
|
|
|
stationName: [
|
|
|
|
|
|
{ validator: validateStationName, trigger: 'blur' }
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
submitSuccess: false,
|
2025-07-14 09:28:21 +08:00
|
|
|
|
keyPoints: [],
|
2025-07-15 13:59:05 +08:00
|
|
|
|
disabled: false,
|
|
|
|
|
|
message: '', // 用于显示消息
|
2025-08-05 16:30:59 +08:00
|
|
|
|
error: false,
|
2025-08-08 17:44:36 +08:00
|
|
|
|
showProgress: false,
|
2025-08-11 13:28:37 +08:00
|
|
|
|
warnTip: false,
|
2025-08-08 17:44:36 +08:00
|
|
|
|
percentage: 0,
|
|
|
|
|
|
intervalId: null // 用于存储定时器ID
|
2025-07-04 17:52:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-08-05 16:30:59 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
...mapGetters(['isTop'])
|
|
|
|
|
|
},
|
2025-07-04 17:52:10 +08:00
|
|
|
|
beforeDestroy () {
|
2025-09-01 14:48:58 +08:00
|
|
|
|
document.removeEventListener('keydown', this.handleKeydown);
|
2025-07-04 17:52:10 +08:00
|
|
|
|
if (this.intervalId) {
|
2025-08-08 17:44:36 +08:00
|
|
|
|
clearTimeout(this.intervalId)
|
2025-07-04 17:52:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-16 10:49:07 +08:00
|
|
|
|
created () {
|
2025-07-14 09:28:21 +08:00
|
|
|
|
this._startMapping()
|
|
|
|
|
|
},
|
2025-08-20 16:48:08 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
// 初始化并启动引导
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.initGuide()
|
|
|
|
|
|
})
|
2025-09-01 14:48:58 +08:00
|
|
|
|
document.addEventListener('keydown', this.handleKeydown);
|
2025-08-20 16:48:08 +08:00
|
|
|
|
},
|
2025-07-04 17:52:10 +08:00
|
|
|
|
methods: {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
/* eslint-disable */
|
2025-09-01 14:48:58 +08:00
|
|
|
|
handleKeydown(event) {
|
|
|
|
|
|
// 仅在对话框可见时响应Enter键
|
|
|
|
|
|
if (this.dialogVisible && event.key === 'Enter') {
|
|
|
|
|
|
event.preventDefault(); // 阻止默认行为
|
|
|
|
|
|
this.stationConfirm();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-08-20 16:48:08 +08:00
|
|
|
|
initGuide() {
|
|
|
|
|
|
const config = {
|
2025-08-22 16:21:36 +08:00
|
|
|
|
// allowClose: false,
|
2025-08-20 16:48:08 +08:00
|
|
|
|
overlayOpacity: 0.7,
|
|
|
|
|
|
popoverClass: 'driverjs-theme',
|
|
|
|
|
|
stagePadding: 0,
|
2025-08-27 11:16:49 +08:00
|
|
|
|
nextBtnText: this.$t('next'),
|
|
|
|
|
|
prevBtnText: this.$t('previous'),
|
|
|
|
|
|
doneBtnText: this.$t('close'),
|
2025-08-29 21:06:21 +08:00
|
|
|
|
onDestroyed: () => {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
this.driverActive = false
|
|
|
|
|
|
},
|
|
|
|
|
|
onPopoverRender: (popover, {config, state}) => {
|
|
|
|
|
|
if (state.activeIndex === 0) {
|
|
|
|
|
|
const popoverElement = document.querySelector('.driver-popover')
|
|
|
|
|
|
if (popoverElement) {
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
|
popoverElement.style.top = '25%'
|
|
|
|
|
|
popoverElement.style.bottom = 'auto'
|
|
|
|
|
|
popoverElement.style.left = 'calc(2% + 0.2rem)'
|
|
|
|
|
|
popoverElement.style.right = 'auto'
|
|
|
|
|
|
}, 20)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
const steps = [
|
|
|
|
|
|
{
|
|
|
|
|
|
element: '#v-step-1',
|
|
|
|
|
|
popover: {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
description: this.$t('driverTxt1'),
|
2025-08-20 16:48:08 +08:00
|
|
|
|
side: 'left',
|
|
|
|
|
|
align: 'center'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
element: '#v-step-2',
|
|
|
|
|
|
popover: {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
description: this.$t('driverTxt2'),
|
2025-08-20 16:48:08 +08:00
|
|
|
|
side: 'top',
|
|
|
|
|
|
align: 'start'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
element: '#v-step-3',
|
|
|
|
|
|
popover: {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
description: this.$t('driverTxt3'),
|
2025-08-20 16:48:08 +08:00
|
|
|
|
side: 'top',
|
|
|
|
|
|
align: 'end'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
this.driver = driver({
|
|
|
|
|
|
...config,
|
|
|
|
|
|
steps
|
|
|
|
|
|
})
|
|
|
|
|
|
this.driver.drive()
|
|
|
|
|
|
},
|
2025-07-15 13:59:05 +08:00
|
|
|
|
// 开始建图
|
2025-07-14 09:28:21 +08:00
|
|
|
|
async _startMapping () {
|
|
|
|
|
|
try {
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading = this.$loading({
|
|
|
|
|
|
lock: true,
|
|
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.6)'
|
|
|
|
|
|
})
|
2025-08-08 17:44:36 +08:00
|
|
|
|
const now = new Date()
|
|
|
|
|
|
const year = now.getFullYear()
|
|
|
|
|
|
const month = String(now.getMonth() + 1).padStart(2, '0') // 月份从0开始,补0
|
|
|
|
|
|
const day = String(now.getDate()).padStart(2, '0')
|
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0')
|
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0')
|
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0')
|
|
|
|
|
|
this.mapName = `apt_map_${year}${month}${day}${hours}${minutes}${seconds}`
|
2025-07-14 17:52:37 +08:00
|
|
|
|
let res = await startMapping(this.mapName)
|
2025-07-16 10:49:07 +08:00
|
|
|
|
if (res && res.code === 200) {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.message = this.$t('carbuildingmap')
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = false
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.glMap.init()
|
|
|
|
|
|
})
|
2025-07-14 09:28:21 +08:00
|
|
|
|
}
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading.close()
|
2025-07-14 09:28:21 +08:00
|
|
|
|
} catch (e) {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.message = this.$t('errorbuildingredone')
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = true
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading.close()
|
2025-07-14 09:28:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-15 13:59:05 +08:00
|
|
|
|
// 打点
|
2025-07-04 17:52:10 +08:00
|
|
|
|
addPoint () {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
if (this.driverActive) return
|
2025-07-14 09:28:21 +08:00
|
|
|
|
this.dialogVisible = true
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.dataForm.stationCode = 'B' + (this.keyPoints.length + 1)
|
2025-08-27 11:16:49 +08:00
|
|
|
|
const na = this.$i18n.locale === 'en-us' ? 'Work point ' : '工作点'
|
|
|
|
|
|
this.dataForm.stationName = `${na}${this.keyPoints.length + 1}`
|
2025-07-14 09:28:21 +08:00
|
|
|
|
},
|
2025-07-15 13:59:05 +08:00
|
|
|
|
// 打点->保存
|
2025-08-27 17:57:33 +08:00
|
|
|
|
stationConfirm () {
|
|
|
|
|
|
this.$refs.dataForm.validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.submitSuccess = true
|
|
|
|
|
|
this._setStation()
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.submitSuccess = false
|
|
|
|
|
|
}, 3000)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-07-14 09:28:21 +08:00
|
|
|
|
async _setStation () {
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = true
|
2025-07-14 09:28:21 +08:00
|
|
|
|
try {
|
2025-08-08 17:44:36 +08:00
|
|
|
|
let res = await setStation(this.dataForm.stationName, this.dataForm.stationCode)
|
2025-07-14 09:28:21 +08:00
|
|
|
|
if (res) {
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: res.message
|
|
|
|
|
|
})
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.keyPoints.push(this.dataForm.stationCode)
|
2025-07-14 09:28:21 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-14 17:52:37 +08:00
|
|
|
|
this.dialogVisible = false
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = false
|
2025-07-14 09:28:21 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
this.$message.error(e)
|
2025-07-14 17:52:37 +08:00
|
|
|
|
this.dialogVisible = false
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = false
|
2025-07-14 09:28:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-08-12 19:52:18 +08:00
|
|
|
|
stopMappingConfirm () {
|
2025-08-20 16:48:08 +08:00
|
|
|
|
if (this.driverActive) return
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.$confirm(this.$t('sureendbuilding'), this.$t('Prompt'), {
|
|
|
|
|
|
confirmButtonText: this.$t('Confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('Cancel'),
|
2025-08-12 19:52:18 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this._stopMapping()
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'info',
|
2025-08-27 11:16:49 +08:00
|
|
|
|
message: this.$t('endbuildingcancel')
|
2025-08-12 19:52:18 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-07-15 13:59:05 +08:00
|
|
|
|
// 结束建图
|
2025-07-14 09:28:21 +08:00
|
|
|
|
async _stopMapping () {
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = true
|
2025-07-14 09:28:21 +08:00
|
|
|
|
try {
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading = this.$loading({
|
|
|
|
|
|
lock: true,
|
|
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.6)'
|
|
|
|
|
|
})
|
2025-07-14 09:28:21 +08:00
|
|
|
|
let res = await stopMapping()
|
2025-07-16 10:49:07 +08:00
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
|
this.message = ''
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = false
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.glMap.closeWebSocket()
|
|
|
|
|
|
})
|
|
|
|
|
|
this._getMappingStatus()
|
2025-07-15 13:59:05 +08:00
|
|
|
|
}
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.disabled = false
|
|
|
|
|
|
this.loading.close()
|
2025-07-15 13:59:05 +08:00
|
|
|
|
} catch (e) {
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.message = this.$t('errorendbuilding')
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.error = true
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = false
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading.close()
|
2025-07-15 13:59:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-08-08 17:44:36 +08:00
|
|
|
|
// 进度条
|
|
|
|
|
|
async _getMappingStatus () {
|
2025-07-15 13:59:05 +08:00
|
|
|
|
try {
|
2025-08-08 17:44:36 +08:00
|
|
|
|
let res = await getMappingStatus()
|
2025-08-11 13:28:37 +08:00
|
|
|
|
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 = []
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.$confirm(this.$t('Newfailedagain'), this.$t('Prompt'), {
|
|
|
|
|
|
confirmButtonText: this.$t('Confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('Cancel'),
|
2025-08-11 13:28:37 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this._startMapping()
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'info',
|
2025-08-27 11:16:49 +08:00
|
|
|
|
message: this.$t('Mapbuildingcancel')
|
2025-08-08 17:44:36 +08:00
|
|
|
|
})
|
2025-08-11 13:28:37 +08:00
|
|
|
|
})
|
2025-07-14 17:52:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.message = ''
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = false
|
2025-08-08 17:44:36 +08:00
|
|
|
|
this.keyPoints = []
|
2025-08-27 11:16:49 +08:00
|
|
|
|
this.$confirm(this.$t('Newfailedagain'), this.$t('Prompt'), {
|
|
|
|
|
|
confirmButtonText: this.$t('Confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('Cancel'),
|
2025-08-08 17:44:36 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this._startMapping()
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'info',
|
2025-08-27 11:16:49 +08:00
|
|
|
|
message: this.$t('Mapbuildingcancel')
|
2025-08-08 17:44:36 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2025-07-14 17:52:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
async _oneClickDeployment () {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let res = await oneClickDeployment(this.mapName)
|
2025-07-16 10:49:07 +08:00
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: res.message
|
|
|
|
|
|
})
|
2025-07-23 20:05:03 +08:00
|
|
|
|
this.needsConfirmation = false
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.$router.push('/index/home')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(res.message)
|
2025-07-14 09:28:21 +08:00
|
|
|
|
}
|
2025-08-11 13:28:37 +08:00
|
|
|
|
this.showProgress = false
|
|
|
|
|
|
this.warnTip = false
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.message = ''
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = false
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.disabled = false
|
|
|
|
|
|
this.loading.close()
|
2025-07-14 09:28:21 +08:00
|
|
|
|
} catch (e) {
|
2025-08-11 13:28:37 +08:00
|
|
|
|
this.showProgress = false
|
|
|
|
|
|
this.warnTip = false
|
2025-07-14 09:28:21 +08:00
|
|
|
|
this.$message.error(e)
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.message = ''
|
2025-08-05 16:30:59 +08:00
|
|
|
|
this.error = false
|
2025-07-15 13:59:05 +08:00
|
|
|
|
this.disabled = false
|
2025-07-16 10:49:07 +08:00
|
|
|
|
this.loading.close()
|
2025-07-04 17:52:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2025-08-20 16:48:08 +08:00
|
|
|
|
.map_container
|
|
|
|
|
|
position relative
|
|
|
|
|
|
width 100%
|
|
|
|
|
|
height calc(100% - .5rem)
|
|
|
|
|
|
margin-bottom .14rem
|
2025-07-16 10:49:07 +08:00
|
|
|
|
.message
|
|
|
|
|
|
min-width 380px
|
|
|
|
|
|
border 1px solid #e1f3d8
|
|
|
|
|
|
border-radius 4px
|
2025-07-15 13:59:05 +08:00
|
|
|
|
position fixed
|
2025-07-16 10:49:07 +08:00
|
|
|
|
left 50%
|
|
|
|
|
|
transform translateX(-50%)
|
|
|
|
|
|
background-color #f0f9eb
|
|
|
|
|
|
transition opacity .3s,transform .4s
|
|
|
|
|
|
overflow hidden
|
|
|
|
|
|
padding 8px 15px
|
2025-08-27 11:16:49 +08:00
|
|
|
|
z-index 2003
|
2025-07-15 13:59:05 +08:00
|
|
|
|
display flex
|
|
|
|
|
|
align-items center
|
2025-07-16 10:49:07 +08:00
|
|
|
|
font-size .16rem
|
|
|
|
|
|
list-height 1
|
|
|
|
|
|
p
|
|
|
|
|
|
margin-left 10px
|
|
|
|
|
|
.custom-message-enter, .custom-message-leave-to
|
|
|
|
|
|
opacity 0
|
|
|
|
|
|
transform translate(-50%,-100%)
|
2025-08-08 17:44:36 +08:00
|
|
|
|
.progress-mask {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.6); /* 半透明黑色遮罩 */
|
|
|
|
|
|
z-index: 9999; /* 确保在最上层 */
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 进度条容器 */
|
|
|
|
|
|
.progress-container {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
padding: 30px 40px;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
}
|
2025-08-11 13:28:37 +08:00
|
|
|
|
.progress_tip {
|
|
|
|
|
|
font-size: .2rem
|
|
|
|
|
|
line-height: .34rem
|
|
|
|
|
|
color: #000
|
|
|
|
|
|
font-weight: 700
|
|
|
|
|
|
}
|
2025-08-27 11:16:49 +08:00
|
|
|
|
.enClass
|
|
|
|
|
|
.button_control
|
|
|
|
|
|
p
|
|
|
|
|
|
font-size .18rem
|
|
|
|
|
|
line-height .16rem
|
2025-07-04 17:52:10 +08:00
|
|
|
|
</style>
|