Browse Source

支出凭证、收入凭证新增防抖

qymljy 2 years ago
parent
commit
ef4c297c94
2 changed files with 13 additions and 3 deletions
  1. 5 1
      src/Form/payvoucher/add.vue
  2. 8 2
      src/Form/recvoucher/add.vue

+ 5 - 1
src/Form/payvoucher/add.vue

@@ -95,7 +95,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="sumbitShow">确 定</el-button>
       </div>
     </el-drawer>
     <enterprise
@@ -117,6 +117,7 @@ export default {
     return {
       dialogFormVisible:false,
       visibleEnterprise:false,
+      sumbitShow:false,
       index:'',
       form:{
         sa_cashbillid:0,
@@ -155,8 +156,10 @@ export default {
   methods:{
     onSubmit(){
       console.log(this.form)
+
       this.$refs['form'].validate(async (valid) => {
         if (!valid) return false
+        this.sumbitShow = true
         const res = await this.$api.requested({
           "id": "20221009102803",
           "version":1,
@@ -167,6 +170,7 @@ export default {
           this.onClose()
           this.$store.dispatch('changeDetailDrawer',true)
           this.$router.push({path:'/payvoucherDetails',query:{id:res.data.sa_cashbillid,rowindex:res.data.rowindex}})
+          this.sumbitShow = false
         })
       })
     },

+ 8 - 2
src/Form/recvoucher/add.vue

@@ -85,7 +85,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="sumbitShow">确 定</el-button>
       </div>
     </el-drawer>
     <enterprise
@@ -107,6 +107,7 @@ export default {
     return {
       dialogFormVisible:false,
       visibleEnterprise:false,
+      sumbitShow:false,
       index:'',
       form:{
         sa_cashbillid:0,
@@ -132,6 +133,9 @@ export default {
         amount:[
           { required: true, message: '收入金额不可为空', trigger: 'blur'},
         ],
+        period:[
+          { required: true, message: '归属日期不可为空', trigger: 'blur'},
+        ],
       },
       enterprises:[],
       accountclass:[],
@@ -144,6 +148,7 @@ export default {
       console.log(this.form)
       this.$refs['form'].validate(async (valid) => {
         if (!valid) return false
+        this.sumbitShow = true
         const res = await this.$api.requested({
           "id": "20221009102803",
           "version":1,
@@ -154,6 +159,7 @@ export default {
           this.onClose()
           this.$store.dispatch('changeDetailDrawer',true)
           this.$router.push({path:'/recvoucherDetails',query:{id:res.data.sa_cashbillid,rowindex:res.data.rowindex}})
+          this.sumbitShow = false
         })
       })
     },
@@ -240,4 +246,4 @@ export default {
 
 <style scoped>
 
-</style>
+</style>