瀏覽代碼

财务2.7 bug修复

hbchen 1 年之前
父節點
當前提交
5cd5afc5e5

+ 19 - 3
src/utils/request.js

@@ -8,10 +8,21 @@ const request = axios.create({
 
 })
 
+let requestList=new Set()
+
 request.interceptors.request.use(
   config=>{
     // console.log(config);
     config.headers['Authorization'] = localStorage.getItem('fsms_token') || ''
+       // 不处理get请求
+    if (config.method !== 'get') {
+      // 利用axios cancelToken 先取消请求
+      config.cancelToken = new axios.CancelToken(e => {
+        // console.log(e, config, 'CancelToken')
+        // 在这里取消重复请求,上个请求未完成时,相同的请求不会再次执行
+        requestList.has(`${config.url}`) ? e(`${config.url}---重复请求被中断`) : requestList.add(`${config.url}`)
+      })
+    }
     return config
   },
   err=>{
@@ -22,6 +33,7 @@ request.interceptors.request.use(
 
 request.interceptors.response.use(
   res=>{
+    requestList.delete(`${res.config.url}`)
     if(res.request.responseType==='blob' || res.request.responseType==='Blob'){
        // 字节流
        if(res.status === 200){
@@ -52,14 +64,18 @@ request.interceptors.response.use(
     }
   },
   err=>{
-      const {message} = err
-      console.log(message);
+    requestList.clear()
+    const {message} = err
+    console.log(message,'--错误信息');
+    if(!err.__CANCEL__){
+      // 多次点击由CancelToken取消的请求不给错误提示
       ElMessage({
         message: message || '网络异常',
         type: 'error',
         duration: 3 * 1000
       })
-      return Promise.reject(err)
+    }
+    return Promise.reject(err)
   }
 )
 

+ 5 - 2
src/views/financialManagement/contractProgress-component/InvoiceAndPayment.vue

@@ -76,6 +76,7 @@
   // 销售离职验证
   const sellerValidator=(row,callback)=>{
     // console.log(row);
+    console.log(row);
     if(row.seller_name.indexOf('已离职')!=-1){
       ElMessage.error(row.seller_name)
       return 
@@ -207,8 +208,10 @@
         }
         // console.log(sellerId);
       }else{
-        sellerId = props.sellerData.rai_list.findIndex(seller => seller.seller_id==sellerId)==-1?sellerName+'-已离职':sellerId
-        sellerName=sellerName+'-已离职'
+        if(props.sellerData.rai_list.findIndex(seller => seller.seller_id==sellerId)==-1){
+          sellerId = sellerName+'-已离职'
+          sellerName=sellerName+'-已离职'
+        }
       }
     }
     amountForm.amountData.push({

+ 7 - 4
src/views/financialStatistics/commodityPayment.vue

@@ -96,6 +96,9 @@ const moment = inject('$moment')
           })
         })
       })
+      // if(!(res.data.list.invoice_currency_total||res.data.list.payment_currency_total)){
+        foldOrUnfold(true)
+      // }
       // console.log(commodityPData.tableData);
     })
   }
@@ -149,11 +152,11 @@ const moment = inject('$moment')
     return ''
   }
   // 开票到款金额展开收起
-  const foldOrUnfold=()=>{
-    if(!(commodityPData.tableData?.length>0)){
+  const foldOrUnfold=(flag)=>{
+    if(commodityPData.tableData?.length==0 && !flag){
       return 
     }
-    isIncomeFold.value = !isIncomeFold.value
+    isIncomeFold.value = flag||flag+''=="false"?flag:!isIncomeFold.value
     // type: 0-开票  1-到款
     // if(type){
     //   placementIsFold.value = !placementIsFold.value
@@ -363,7 +366,7 @@ const moment = inject('$moment')
       <div class="operation-zone" ref="operationZone">
         <div class="amount-show-zone">
           <div class="amount-show-item">
-            <div class="amount-item-head" @click="foldOrUnfold" 
+            <div class="amount-item-head" @click="foldOrUnfold()" 
             :style="{cursor:commodityPData.tableData?.length>0?'pointer':''}">
               <div class="amount-item-head-title" >
                 <el-tooltip placement="top">