修改部分按钮重复点击

This commit is contained in:
GGJ
2024-10-16 17:54:55 +08:00
parent 89535b6059
commit e470554b7c
18 changed files with 492 additions and 1082 deletions

View File

@@ -70,8 +70,8 @@
<span class="dialog-footer">
<el-button @click="close">取消</el-button>
<!-- <el-button type="primary" @click="submit">确认</el-button> -->
<el-button type="primary" @click="submit(true)">保存</el-button>
<el-button type="primary" @click="submit(false)">提交审批</el-button>
<el-button type="primary" @click="submit(true)" :loading="loading" >保存</el-button>
<el-button type="primary" @click="submit(false)" :loading="loading" >提交审批</el-button>
</span>
</template>
</el-dialog>
@@ -90,6 +90,7 @@ const openFile = (name: any) => {
const acceptType = ref('')
//下拉数据源
const title = ref('')
const loading = ref(false)
const tableStore = inject('tableStore') as TableStore
const formRef = ref()
// 上传报告
@@ -206,7 +207,8 @@ const close = () => {
/**
* 提交用户表单数据
*/
const submit = (flag: boolean) => {
const submit =async (flag: boolean) => {
loading.value = true
if (flag) {
let subForm = JSON.parse(JSON.stringify(form.value))
subForm = {
@@ -215,7 +217,7 @@ const submit = (flag: boolean) => {
}
subForm.saveOrCheckflag = '1'
//此时该告警单处于待反馈状态
addFeedback(subForm).then(res => {
await addFeedback(subForm).then(res => {
//查询进线数据避免一直处于loading状态
ElMessage.success('保存成功!')
tableStore.index()
@@ -254,6 +256,9 @@ const submit = (flag: boolean) => {
}
})
}
await setTimeout(() => {
loading.value = false
}, 0)
}
defineExpose({ open })