feat: 表单保存交互规范P1+P2+P3 — 保存按钮loading防重复(KPIList/UserManage/KPIDetail)+KPIList编辑弹窗化(详情跳页并存)+保存反馈全面核查
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
<el-form-item label="计算公式"><el-input v-model="kpi.formula" type="textarea" :rows="2" /></el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item><el-button type="primary" @click="save">保存</el-button></el-form-item>
|
||||
<el-form-item><el-button type="primary" :loading="saving" @click="save">保存</el-button></el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 元数据卡片 -->
|
||||
@@ -305,6 +305,7 @@ const fullNetworkLoading = ref(false)
|
||||
// 编辑未保存离开确认(统一守卫 composable)
|
||||
const isDirty = ref(false)
|
||||
useFormGuard(isDirty)
|
||||
const saving = ref(false)
|
||||
let kpiSnapshot: string = ''
|
||||
|
||||
let watchInitialized = false
|
||||
@@ -539,6 +540,8 @@ const fullNetworkChartOption = computed(() => {
|
||||
})
|
||||
|
||||
async function save() {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
await kpiApi.update(kpi.value.id, kpi.value)
|
||||
ElMessage.success('保存成功')
|
||||
@@ -549,6 +552,8 @@ async function save() {
|
||||
kpiSnapshot = JSON.stringify(kpi.value)
|
||||
} catch (e) {
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user