Explorar o código

change: indent报价编辑.增加loading强制拦截反复提交.

peter hai 1 semana
pai
achega
f5ff1b0219
Modificáronse 1 ficheiros con 39 adicións e 14 borrados
  1. 39 14
      src/pages/indent-manage/indent/components/info.vue

+ 39 - 14
src/pages/indent-manage/indent/components/info.vue

@@ -11,7 +11,10 @@
     >
       <div style="color: #ef4135">* 为了报价单的内容,请填写英文信息</div>
 
-      <div class="form-table">
+      <div
+        class="form-table"
+        v-loading="loading"
+      >
         <div class="flex items-stretch form-header">
           <div class="first-label"></div>
           <div class="second-label">操作</div>
@@ -178,7 +181,7 @@
                 </div>
               </div>
             </div>
-            
+
             <div class="flex items-stretch">
               <div class="second-label">
                 {{ $t(prefix + 'label_cert') }}
@@ -1016,6 +1019,7 @@
 
       <div
         v-show="canAddForm"
+        v-loading="loading"
         class="btn-add-indent-info flex justify-center flex-col items-center"
         @click="addFormColumn"
       >
@@ -1033,6 +1037,7 @@
         <div class="flex justify-center items-center">
           <!-- v-show="$showAuthBtn(429)" -->
           <el-button
+            :loading="loading"
             type="primary"
             size="small"
             @click="checkForm"
@@ -1040,7 +1045,7 @@
             {{ $t('btn_save') }}
           </el-button>
           <el-button
-            type=""
+            :loading="loading"
             size="small"
             @click="close"
           >
@@ -1326,6 +1331,13 @@ const deleteForm = function (index: number) {
   }
 }
 const addFormColumn = function () {
+  if (loading.value) {
+    ElMessage.warning({
+      message: '正在提交中, 请勿重复提交',
+      duration: 2000,
+    })
+    return
+  }
   if (canAddForm.value) {
     forms.value.push(
       Object.assign(cloneDeep(formDemo), {
@@ -1433,6 +1445,7 @@ const getCurrentAuditUser = () => {
   })
 }
 getCurrentAuditUser()
+let loading = ref(false)
 const createQuoteFunc = function () {
   const params = {
     file: '', // 疑似永远为空
@@ -1485,19 +1498,24 @@ const createQuoteFunc = function () {
   //     },
   //   )
   // }
-  createQuote(params).then((response: any) => {
-    if (response.code !== 1) return
+  loading.value = true
+  createQuote(params)
+    .then((response: any) => {
+      if (response.code !== 1) return
 
-    ElNotification({
-      title: '成功',
-      message: '提交成功',
-      type: 'success',
-      duration: 3000,
-    })
+      ElNotification({
+        title: '成功',
+        message: '提交成功',
+        type: 'success',
+        duration: 3000,
+      })
 
-    $emit('create', response.result)
-    close()
-  })
+      $emit('create', response.result)
+      close()
+    })
+    .finally(() => {
+      loading.value = false
+    })
 }
 
 const inputFilter = (value: string, target: any, key: string) => {
@@ -1512,6 +1530,13 @@ const getFormRef = (el: any, key: string) => {
   formRef.value[`${key}`] = el
 }
 const checkForm = function () {
+  if (loading.value) {
+    ElMessage.warning({
+      message: '正在提交中, 请勿重复提交',
+      duration: 2000,
+    })
+    return
+  }
   const key = [
     'vendor_id',
     'product_name',