修改部分按钮重复点击

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

@@ -352,8 +352,8 @@
<template #footer>
<div class="dialog-footer">
<el-button @click="close()">取消</el-button>
<el-button type="primary" @click="confirmForm(true)">保存</el-button>
<el-button type="primary" @click="confirmForm(false)">提交审批</el-button>
<el-button type="primary" @click="confirmForm(true)" :loading="loading" >保存</el-button>
<el-button type="primary" @click="confirmForm(false)" :loading="loading" >提交审批</el-button>
</div>
</template>
</el-dialog>
@@ -376,6 +376,7 @@ const dictData = useDictData()
const dialogFormVisible = ref(false)
const form: any = ref({})
const title = ref('')
const loading = ref(false)
const ruleFormRef: any = ref(null)
// acceptType .doc,.docx,.xlsx,.xls,.pdf
const acceptType = ''
@@ -1081,7 +1082,8 @@ const disabledDate = time => {
}
const activeName = ref('0')
//提交
const confirmForm = (flag: boolean) => {
const confirmForm = async (flag: boolean) => {
loading.value = true
if (flag) {
form.value.reportDate = window.XEUtils.toDateString(form.value.reportDate, 'yyyy-MM-dd')
let confirmFormData = JSON.parse(JSON.stringify(form.value))
@@ -1105,7 +1107,7 @@ const confirmForm = (flag: boolean) => {
}
confirmFormData.saveOrCheckflag = '1'
if (title.value != '监测点信息') confirmFormData.id = resendId.value
addMointorPointFormData(confirmFormData).then(res => {
await addMointorPointFormData(confirmFormData).then(res => {
ElMessage({
message: '保存成功!',
type: 'success'
@@ -1117,7 +1119,7 @@ const confirmForm = (flag: boolean) => {
} else {
// 先判断提交终端信息与监测点信息
// 提交监测点信息
ruleFormRef.value.validate(valid => {
ruleFormRef.value.validate(async(valid) => {
if (valid) {
//整理上传文件的数据
//处理填报日期时间格式
@@ -1145,7 +1147,7 @@ const confirmForm = (flag: boolean) => {
}
confirmFormData.saveOrCheckflag = '2'
if (title.value == '监测点信息') {
addMointorPointFormData(confirmFormData).then(res => {
await addMointorPointFormData(confirmFormData).then(res => {
ElMessage({
message: '新增成功',
type: 'success'
@@ -1156,7 +1158,7 @@ const confirmForm = (flag: boolean) => {
})
} else {
confirmFormData.id = resendId.value
updateMointorPointFormData(confirmFormData).then(res => {
await updateMointorPointFormData(confirmFormData).then(res => {
if (res.code == 'A0000') {
ElMessage({
message: '重新发起成功',
@@ -1174,6 +1176,9 @@ const confirmForm = (flag: boolean) => {
}
})
}
await setTimeout(() => {
loading.value = false
}, 0)
}
defineExpose({ open })
</script>