瀏覽代碼

change: indent创建报价增加点击拦截.

peter 1 月之前
父節點
當前提交
ba1a30ca22
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      src/pages/indent-manage/indent/edit.vue

+ 10 - 1
src/pages/indent-manage/indent/edit.vue

@@ -263,6 +263,7 @@
           <el-button
             size="small"
             type="primary"
+            :loading="commitLoading"
             @click="checkForm(indentForm)"
           >
             {{ $t('btn_submit') }}
@@ -270,6 +271,7 @@
           <el-button
             size="small"
             type="primary"
+            :loading="commitLoading"
             @click="checkForm(indentForm, false)"
           >
             {{ $t(prefix_edit + 'btn_submit_and_next') }}
@@ -566,13 +568,14 @@ const addInfo = () => {
   infoVisible.value = quoteList.value.length ? 2 : 1
 }
 
+let commitLoading = ref(false)
 const $mediaRegExp = inject('mediaRegExp') as RegExp
 const indentForm = ref<FormInstance>()
 const checkForm = (
   formEl: FormInstance | undefined,
   closeAfterCreate = true,
 ) => {
-  if (!formEl) return
+  if (!formEl || commitLoading.value) return
   formEl.validate((valid: boolean) => {
     if (valid) {
       form.value.picture = imageList.value
@@ -588,6 +591,7 @@ const checkForm = (
       // )
       console.log(form.value, 'form.value')
       form.value.quotes = quoteList.value.map((d: any) => d.entity_id || d.id)
+      commitLoading.value = true
       createIndent(form.value)
         .then((response: any) => {
           // console.log(response, 'create indent')
@@ -616,6 +620,11 @@ const checkForm = (
               '请稍后再试. 或者按F12打开控制台, 把错误信息复制出来找管理员排查.',
           })
         })
+        .finally(() => {
+          commitLoading.value = false
+        })
+    } else {
+      commitLoading.value = false
     }
   })
 }