fix: 战略地图创建保存防重 — 按钮loading防重复创建(修复一次保存9份)
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
</div>
|
||||
<div class="map-form-footer">
|
||||
<el-button size="small" @click="showForm=false">取消</el-button>
|
||||
<el-button size="small" type="primary" @click="saveMap">保存</el-button>
|
||||
<el-button size="small" type="primary" :loading="saving" @click="saveMap">保存</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,6 +70,7 @@ const showForm = ref(false)
|
||||
const editingMap = ref<any>(null)
|
||||
const form = ref<any>({})
|
||||
const createMode = ref("blank")
|
||||
const saving = ref(false)
|
||||
const selectedIds = ref<number[]>([])
|
||||
|
||||
function onSelectionChange(rows: any[]) {
|
||||
@@ -96,6 +97,8 @@ function goCanvas(id: number) { router.push('/maps/canvas/' + id) }
|
||||
function goVersion(id: number) { router.push('/maps/versions/' + id) }
|
||||
|
||||
async function saveMap() {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
if (editingMap.value) {
|
||||
await mapApi.update(editingMap.value.id, form.value)
|
||||
@@ -112,6 +115,8 @@ async function saveMap() {
|
||||
load()
|
||||
} catch (e) {
|
||||
ElMessage.error("操作失败")
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user