Browse Source

按钮点击防抖,序列码分配添加校验

wzl 2 years ago
parent
commit
5e9d504def

+ 27 - 2
src/views/Assignlicense.vue

@@ -12,7 +12,9 @@ export default {
       memberId: '',
       teamList: [],
       memberList: [],
-      productList: []
+      productList: [],
+      singleLoading: false,
+      teamLoading: false
     }
   },
   mounted() {
@@ -71,6 +73,15 @@ export default {
   },
   methods: {
     assignLicense() {
+      if (this.signleAssign === ''
+      || this.memberId === '' || this.memberId == undefined || this.memberId == null || this.memberId.length <= 0
+      || this.signleProduct === '' || this.signleProduct == undefined || this.signleProduct == null || this.signleProduct.length <= 0
+      ) {
+        this.$message.error('Missing required information')
+        return
+      }
+      if (this.singleLoading) return
+      this.singleLoading = true
       var urlencoded = new URLSearchParams()
       urlencoded.append('memberIds', this.memberId)
       urlencoded.append('teamId', this.signleAssign)
@@ -79,6 +90,9 @@ export default {
         'http://81.68.234.235:8032/pdf-tech/vppLicenseCode/singleAssign',
         urlencoded
       ).then((res) => {
+        setTimeout(() => {
+          this.singleLoading = false
+        }, 1000)
         if (res.data.code === 200 && res.data.msg == ' Assign Success!') {
           this.$message({
             message: 'Assign Success!',
@@ -96,13 +110,24 @@ export default {
       })
     },
     assignTeamLicense() {
+      if (this.teamAssign === ''
+      || this.teamProduct === '' || this.teamProduct == undefined || this.teamProduct == null || this.teamProduct.length <= 0
+      ) {
+        this.$message.error('Missing required information')
+        return
+      }
+      if (this.teamLoading) return
+      this.teamLoading = true
       var urlencoded = new URLSearchParams()
-      urlencoded.append('teamId', this.teamAssing)
+      urlencoded.append('teamId', this.teamAssign)
       urlencoded.append('productIds', this.teamProduct)
       post(
         'http://81.68.234.235:8032/pdf-tech/vppLicenseCode/teamAssign',
         urlencoded
       ).then((res) => {
+        setTimeout(() => {
+          this.teamLoading = false
+        }, 1000)
         if (res.data.code === 200 && res.data.msg == ' Assign Success!') {
           this.$message({
             message: 'Assign Success!',

+ 22 - 4
src/views/Dashboard.vue

@@ -21,12 +21,14 @@ export default {
         timeLeft: null
       },
       dataFilterProductSelect: '',
+      dataFilterSelectLoading: false,
       chartData: {
         date: [],
         assignedLicensesYData: [],
         activatedLicenseYData: []
       },
-      chartSelectValue: '',   
+      chartSelectValue: '',
+      chartSelectLoading: false,
       teamData: {
         totalTeam: null,
         totalMember: null,
@@ -39,13 +41,14 @@ export default {
       },
       teamList: [],
       teamSelect: '',
-      teamFilterProductSelect: ''
+      teamFilterProductSelect: '',
+      teamSelectLoading: false
     }
   },
   created () {
     this.getOverview()
     this.getOverviewProduct()
-    this.getChartStatistics(1)
+    this.getChartStatistics(2)
     this.getTeamData()
     this.getTeamMemberData()
     this.getProductList()
@@ -68,9 +71,14 @@ export default {
     },
     // 获取全局预览数据,区分产品
     getOverviewProduct () {
+      if (this.dataFilterSelectLoading) return
+      this.dataFilterSelectLoading = true
       get('http://81.68.234.235:8032/pdf-tech/vppDashboard/getOverviewProduct', {
         codeList: this.dataFilterProductSelect
       }).then((res) => {
+        setTimeout(() => {
+          this.dataFilterSelectLoading = false
+        }, 1000)
         Object.keys(this.overviewProduct).forEach(key => (this.overviewProduct[key] = ''))
         if (res.data.code === 200) {
           this.overviewProduct.totalLicenses = res.data.result.totalLicenses
@@ -84,12 +92,17 @@ export default {
     },
     // 获取图表数据
     getChartStatistics (type) {
+      if (this.chartSelectLoading) return
+      this.chartSelectLoading = true
       if (this.chartSelectValue !== '') {
         type = this.chartSelectValue
       } else {
-        type = 1
+        type = 2
       }
       get('http://81.68.234.235:8032/pdf-tech/vppDashboard/getChartStatistics/' + type).then((res) => {
+        setTimeout(() => {
+          this.chartSelectLoading = false
+        }, 1000)
         if (res.data.code === 200) {
           this.chartData.date = []
           this.chartData.assignedLicensesYData = []
@@ -117,10 +130,15 @@ export default {
     },
     // 获取团队成员数据
     getTeamMemberData () {
+      if (this.teamSelectLoading) return
+      this.teamSelectLoading = true
       get('http://81.68.234.235:8032/pdf-tech/vppDashboard/getTeamMemberData', {
         teamId: this.teamSelect,
         codeList: this.teamFilterProductSelect
       }).then((res) => {
+        setTimeout(() => {
+          this.teamSelectLoading = false
+        }, 1000)
         Object.keys(this.teamMemberData).forEach(key => (this.teamMemberData[key] = ''))
         if (res.data.code === 200) {
           this.teamMemberData.teamMember = res.data.result.teamMember

+ 13 - 1
src/views/Device.vue

@@ -26,7 +26,9 @@ export default {
       dialogVisible: false,
       deviceId: '',
       cancelEmail: '',
-      cancelUniqueSn: ''
+      cancelUniqueSn: '',
+      filterLoading: false,
+      downloadLoading: false
     }
   },
   mounted() {
@@ -41,6 +43,8 @@ export default {
   methods: {
     //分页查询
     pagingQuery() {
+      if (this.filterLoading) return
+      this.filterLoading = true
       get(
         'http://81.68.234.235:8032/pdf-tech/vppDevice/page?page=' +
           this.currentPage +
@@ -60,6 +64,9 @@ export default {
           'queryString=' +
           this.queryString
       ).then((res) => {
+        setTimeout(() => {
+          this.filterLoading = false
+        }, 1000)
         this.tableData = res.data.result.list
         this.total = res.data.result.total
       })
@@ -120,12 +127,17 @@ export default {
     },
     // 下载设备文件
     downLoad(){
+      if (this.downloadLoading) return
+      this.downloadLoading = true
       var urlencoded = new URLSearchParams()
       urlencoded.append("queryString", this.queryString)
       urlencoded.append("productId", this.productId)
       urlencoded.append("teamId", this.teamId)
       urlencoded.append("status", this.status)
       downLoad("http://81.68.234.235:8032/pdf-tech/vppDevice/download", urlencoded).then((res)=>{
+        setTimeout(() => {
+          this.downloadLoading = false
+        }, 2000)
         let url = window.URL.createObjectURL(new Blob([res.data], { type: '.xlsx' }))
         let a= document.createElement('a')
         a.style.display = 'none'

+ 12 - 0
src/views/LicenseManage.vue

@@ -19,6 +19,8 @@ const productList = ref([])
 const teamList = ref([])
 const dialogVisible = ref(false)
 const cancelEmail = ref('')
+const filterLoading = ref(false)
+const downloadLoading = ref(false)
 onMounted(() => {
   let pageText = document.getElementsByClassName('el-pagination__jump')[0]
   if (pageText) {
@@ -29,6 +31,8 @@ onMounted(() => {
   getTeamList()
 })
 const pagingQuery = (val) => {
+  if (filterLoading.value) return
+  filterLoading.value = true
   get(
     'http://81.68.234.235:8032/pdf-tech/vppLicenseCode/page?page=' +
       currentPage.value +
@@ -48,6 +52,9 @@ const pagingQuery = (val) => {
       'queryString=' +
       queryString.value
   ).then((res) => {
+    setTimeout(() => {
+      filterLoading.value = false
+    }, 1000)
     tableData.value = res.data.result.list
     total.value = res.data.result.total
   })
@@ -79,6 +86,8 @@ const handleClick = (val) => {
 }
 //导出序列码
 const download = () => {
+  if (downloadLoading.value) return
+  downloadLoading.value = true
   var urlencoded = new URLSearchParams()
   urlencoded.append("queryString", queryString.value)
   urlencoded.append("productId", productId.value)
@@ -86,6 +95,9 @@ const download = () => {
   urlencoded.append("status", status.value)
   downLoad('http://81.68.234.235:8032/pdf-tech/vppLicenseCode/download',urlencoded).then(
     (res) => {
+      setTimeout(() => {
+        downloadLoading.value = false
+      }, 2000)
       let url = window.URL.createObjectURL(new Blob([res.data], { type: '.xlsx' }))
       let a= document.createElement('a')
       a.style.display = 'none'

+ 6 - 0
src/views/ProductManagement.vue

@@ -14,6 +14,7 @@ const cancelUniqueSn = ref('')
 const total = ref(0)
 const productList = ref([])
 const productId = ref('')
+const loading = ref(false)
 
 onMounted(() => {
   let pageText = document.getElementsByClassName('el-pagination__jump')[0]
@@ -29,6 +30,8 @@ const searchInfo = () => {
 }
 //获取分页数据
 const pagingQuery = () => {
+  if (loading.value) return
+  loading.value = true
   get(
     'http://81.68.234.235:8032/pdf-tech/vppOrderDetail/pageByCompany?page=' +
       currentPage.value +
@@ -39,6 +42,9 @@ const pagingQuery = () => {
       'code=' +
       productId.value
   ).then((res) => {
+    setTimeout(() => {
+      loading.value = false
+    }, 1000)
     tableData.value = res.data.result.list
     total.value = res.data.result.total
   })

+ 7 - 2
src/views/Settings.vue

@@ -38,7 +38,8 @@ export default {
             trigger: ['']
           }
         ]
-      }
+      },
+      generalLoading: false
     }
   },
   methods: {
@@ -84,11 +85,15 @@ export default {
     changeInfo() {
       this.$refs['ruleForm'].validate((valid) => {
         if (valid) {
+          if (this.generalLoading) return
+          this.generalLoading = true
           put('http://81.68.234.235:8032/pdf-tech/vppSet/setGeneral', {
             userName: this.ruleForm.userName,
             area: this.ruleForm.area
           }).then((res) => {
-            console.log(res)
+            setTimeout(() => {
+              this.generalLoading = false
+            }, 1000)
             if (res.data.code === 200 && res.data.msg === 'success') {
               this.$message({
                 message: 'Change Success',

+ 4 - 1
src/views/TeamManagement/ManageTeam.vue

@@ -86,7 +86,10 @@ function handleDelete() {
     teamId: deleteTeamId.value
   }).then((res) => {
     if (res.data.code === 200) {
-      proxy.$message('Delete Success')
+      proxy.$message({
+        message: 'Delete Success',
+        type: 'success'
+      })
       tableData.value.splice(deleteTeamIndex.value, 1)
     } else (
       proxy.$message.error(res.data.msg)

+ 8 - 2
src/views/TeamManagement/ManageTeamOperate.vue

@@ -96,7 +96,10 @@ export default {
       })
       postWithHeader('http://81.68.234.235:8032/pdf-tech/vppTeam/createTeam', JSON.stringify(this.formData)).then((res) => {
         if (res.data.code === 200) {
-          this.$message('Change Success')
+          this.$message({
+            message: 'Change Success',
+            type: 'success'
+          })
           this.$router.push({name:'ManageTeam'})
         } else (
           this.$message.error(res.data.msg)
@@ -112,7 +115,10 @@ export default {
       })
       putWithHeader('http://81.68.234.235:8032/pdf-tech/vppTeam/editTeam', JSON.stringify(this.formData)).then((res) => {
         if (res.data.code === 200) {
-          this.$message('Change Success')
+          this.$message({
+            message: 'Change Success',
+            type: 'success'
+          })
           this.$router.push({name:'ManageTeam'})
         } else (
           this.$message.error(res.data.msg)

+ 7 - 1
src/views/VolumeCancel.vue

@@ -5,7 +5,8 @@ export default {
   data() {
     return {
       file: {},
-      fileList: []
+      fileList: [],
+      loading: false
     }
   },
   methods: {
@@ -15,10 +16,15 @@ export default {
     },
     //提交表单
     submitFormVolume(){
+      if (this.loading) return
+      this.loading = true
       this.$refs.upload.submit()
       const formData = new FormData()
       formData.append("file",this.file)
       post('http://81.68.234.235:8032/pdf-tech/vppLicenseCode/cancelLicenceAssignBatch', formData).then((res) => {
+        setTimeout(() => {
+          this.loading = false
+        }, 1000)
         if(res.data.code === 200){
           this.$message({
             message: 'Assign Success!',