feat: 表单保存交互规范P1+P2+P3 — 保存按钮loading防重复(KPIList/UserManage/KPIDetail)+KPIList编辑弹窗化(详情跳页并存)+保存反馈全面核查
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showForm=false">取消</el-button>
|
||||
<el-button type="primary" @click="saveUser">保存</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="saveUser">保存</el-button>
|
||||
</template>
|
||||
</MyDialog>
|
||||
</div>
|
||||
@@ -66,6 +66,7 @@ const loading = ref(false)
|
||||
const showForm = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const form = ref<any>({})
|
||||
const saving = ref(false)
|
||||
|
||||
function roleLabel(role: string) {
|
||||
const map: Record<string, string> = { ceo: 'CEO', finance: '财务', business: '业务', it: 'IT管理' }
|
||||
@@ -94,6 +95,8 @@ function openForm(row: any) {
|
||||
}
|
||||
|
||||
async function saveUser() {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
if (isEdit.value) {
|
||||
const payload: any = {}
|
||||
@@ -106,6 +109,7 @@ async function saveUser() {
|
||||
} else {
|
||||
if (!form.value.username || !form.value.password) {
|
||||
ElMessage.warning('用户名和密码必填')
|
||||
saving.value = false
|
||||
return
|
||||
}
|
||||
await userApi.create(form.value)
|
||||
@@ -115,6 +119,8 @@ async function saveUser() {
|
||||
load()
|
||||
} catch (e) {
|
||||
ElMessage.error('操作失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user