diff --git a/src/views/newMap/newMapdraft/dataRelation/runLeveloperate/route.vue b/src/views/newMap/newMapdraft/dataRelation/runLeveloperate/route.vue index 1f9e0ea22..e826094c7 100644 --- a/src/views/newMap/newMapdraft/dataRelation/runLeveloperate/route.vue +++ b/src/views/newMap/newMapdraft/dataRelation/runLeveloperate/route.vue @@ -3,11 +3,7 @@
- - - - -
+
- - - 生成等级 - - -
-
- - - - - {{ $t('map.activate') }} - - - - - - {{ $t('map.activate') }} - - - - - - {{ $t('map.activate') }} - - - - - - {{ $t('map.activate') }} - - - - - - - m - - - - s - - - - s - - - - s - - - - s - - - - s - - - - {{ $t('map.lastStep') }} - - - - {{ $t('map.save') }} - {{ $t('map.updata') }} - - +
+
+
运行等级数据
+
+ 生成等级 +
+
+
+
+ + + m + + + + s + + + + s + + + + s + + + + s + + + + s + +
+
+
+
+ + + {{ $t('map.save') }} + {{ $t('map.updata') }} + + +
@@ -201,7 +141,7 @@ export default { }, data() { return { - display: 1, // 默认显示第一个 + display:false, // 是否显示运行等级数据 field: '', editShow: false, loading:false, @@ -266,7 +206,7 @@ export default { routeData(val, old) { if (val) { this.addModel = val; - this.display = 2; + this.display = true; this.editShow = true; this.runLevelId = ''; if (val.id) { @@ -310,16 +250,20 @@ export default { generateLevel() { // 生成运行等级 this.$refs.form.validate(async (valid) => { if (valid) { - const res = await postGenerateLevel(this.addModel); - if (res.code == 200) { - this.display = 2; - this.addModel.l1 = res.data.l1; - this.addModel.l2 = res.data.l2; - this.addModel.l3 = res.data.l3; - this.addModel.l4 = res.data.l4; - this.addModel.l5 = res.data.l5; - this.addModel.distance = res.data.distance; - } + postGenerateLevel(this.addModel).then(res=>{ + if (res.code == 200) { + this.display = 2; + this.addModel.l1 = res.data.l1; + this.addModel.l2 = res.data.l2; + this.addModel.l3 = res.data.l3; + this.addModel.l4 = res.data.l4; + this.addModel.l5 = res.data.l5; + this.addModel.distance = res.data.distance; + this.display = true; + } + }).catch((error)=>{ + this.$messageBox('生成运行等级失败: ' + error.message); + }); } }); }, @@ -341,24 +285,38 @@ export default { } }, save() { - this.loading = true; - if (this.editShow) { - putUploadLevel(this.runLevelId, this.addModel).then(res => { // 更新内容 - this.$message.success('更新成功'); - this.clear(); - }).catch(() => { - this.$messageBox('更新失败'); - this.loading = false; - }); - } else { - postSaveLevel(this.addModel).then(res => { // 保存 - this.$message.success('保存成功'); - this.clear(); - }).catch(() => { - this.$messageBox('保存失败'); - this.loading = false; - }); - } + this.$refs.form.validate(async (valid) => { + if (valid) { + + if (this.editShow) { + this.loading = true; + putUploadLevel(this.runLevelId, this.addModel).then(res => { // 更新内容 + this.$message.success('更新成功'); + this.clear(); + this.display = false; + }).catch(() => { + this.$messageBox('更新失败'); + this.loading = false; + }); + } else { + if (this.display) { + this.loading = true; + postSaveLevel(this.addModel).then(res => { // 保存 + this.$message.success('保存成功'); + this.clear(); + this.display = false; + }).catch(() => { + this.$messageBox('保存失败'); + this.loading = false; + }); + } else { + this.$messageBox('请生成等级'); + } + + } + } + }); + }, clear() { if (this.$refs && this.$refs.form && this.mapInfo) { @@ -383,9 +341,6 @@ export default { this.loading = false; } }, - lastStep() { - this.display = 1; - }, hover(field) { this.field = field === this.field ? '' : field; }, @@ -407,5 +362,26 @@ export default {