Browse Source

修复bug

逆水行舟 2 months ago
parent
commit
e53a6dec99

+ 9 - 0
src/api/omsOrder.ts

@@ -326,6 +326,15 @@ export function dsCallbackLog(params: any) {
   });
 }
 
+//订单时间日志
+export function orderTimeList(params: any) {
+  return request({
+    url: "/omsOrder/orderTimeLog/list",
+    params: params,
+    method: "GET",
+  });
+}
+
 //wms电子面单
 export function dswWaybill(params: any) {
   return request({

+ 1 - 1
src/benyun/utils/auth.ts

@@ -6,7 +6,7 @@ const ExpiresInKey = "AdminOMS-Expires-In";
 
 export function getToken() {
   if (process.env.NODE_ENV === "development") {
-    return "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6Ijg2ODM1N2M0LTEwOTgtNGNmZS05YWM1LTA0ZGRmYmIxZmVjNCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.4OXHy4kWg_bsIYVb_LN5wnrFj2kKRIWfHG0k47GgjU0KtuY2wsmB-ldi03Pb5E9ppqj35k0uCAGXEJokcPvYbw";
+    return "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImQ2Y2JhODYxLTE3NzgtNDM2OS1hYmU0LTRmNDk0NzI1NTcwYiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.KpYcuxOuFRr_OkROPEH0_7X8stC5CgE538ZUkM7MZHIhmx29kv5Mxgno84kWhBA_cy_8y3eApdOJY6-Rtl49dQ";
   } else {
     return Cookies.get(TokenKey);
   }

+ 169 - 123
src/benyun/utils/request.ts

@@ -1,171 +1,217 @@
-import axios from 'axios'
-import {Loading, Message, MessageBox, Notification} from 'element-ui'
-import store from '@/store/index'
-import {getToken} from '@/benyun/utils/auth'
-import errorCode from '@/benyun/utils/errorCode'
-import {blobValidate, tansParams} from "@/benyun/utils/benyuntech";
-import cache from '@/benyun/plugins/cache'
-import {saveAs} from 'file-saver'
+import axios from "axios";
+import { Loading, Message, MessageBox, Notification } from "element-ui";
+import store from "@/store/index";
+import { getToken } from "@/benyun/utils/auth";
+import errorCode from "@/benyun/utils/errorCode";
+import { blobValidate, tansParams } from "@/benyun/utils/benyuntech";
+import cache from "@/benyun/plugins/cache";
+import { saveAs } from "file-saver";
 
-let downloadLoadingInstance:any;
+let downloadLoadingInstance: any;
 // 是否显示重新登录
 export let isRelogin = { show: false };
 
-axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
+axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 // 创建axios实例
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: process.env.VUE_APP_BASE_API,
   // 超时
-  timeout: 60000
-})
+  timeout: 60000,
+});
 
 // request拦截器
-service.interceptors.request.use((config:any) => {
-  // 是否需要设置 token
-  const isToken = (config.headers || {}).isToken === false
-  // 是否需要防止数据重复提交
-  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
-  //获取用户信息
-  const user = store.getters.userInfo;
-  //设置租户id
-  if(user.tenantId){
-    config.headers['tenantId'] = user.tenantId
-  }
-  if(user.userId){
-    config.headers['user_id'] = user.userId
-  }
-  if(user.userName){
-    config.headers['username'] = user.userName
-  }
-  if (getToken() && !isToken) {
-    config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
-  }
-  // get请求映射params参数
-  if ((config.method === 'get' || config.method === 'post') && config.params) {
-    let url = config.url + '?' + tansParams(config.params);
-    url = url.slice(0, -1);
-    config.params = {};
-    config.url = url;
-  }
-  if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
-    const requestObj = {
-      url: config.url,
-      data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
-      time: new Date().getTime()
+service.interceptors.request.use(
+  (config: any) => {
+    // 是否需要设置 token
+    const isToken = (config.headers || {}).isToken === false;
+    // 是否需要防止数据重复提交
+    const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
+    //获取用户信息
+    const user = store.getters.userInfo;
+    //设置租户id
+    if (user.tenantId) {
+      config.headers["tenantId"] = user.tenantId;
     }
-    const sessionObj = cache.session.getJSON('sessionObj')
-    if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
-      cache.session.setJSON('sessionObj', requestObj)
-    } else {
-      const s_url = sessionObj.url;                  // 请求地址
-      const s_data = sessionObj.data;                // 请求数据
-      const s_time = sessionObj.time;                // 请求时间
-      const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
-      if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
-        const message = '数据正在处理,请勿重复提交';
-        console.warn(`[${s_url}]: ` + message)
-        return Promise.reject(new Error(message))
+    if (user.userId) {
+      config.headers["user_id"] = user.userId;
+    }
+    if (user.userName) {
+      config.headers["username"] = user.userName;
+    }
+    if (getToken() && !isToken) {
+      config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
+    }
+    // get请求映射params参数
+    if (
+      (config.method === "get" || config.method === "post") &&
+      config.params
+    ) {
+      let url = config.url + "?" + tansParams(config.params);
+      url = url.slice(0, -1);
+      config.params = {};
+      config.url = url;
+    }
+    if (
+      !isRepeatSubmit &&
+      (config.method === "post" || config.method === "put")
+    ) {
+      const requestObj = {
+        url: config.url,
+        data:
+          typeof config.data === "object"
+            ? JSON.stringify(config.data)
+            : config.data,
+        time: new Date().getTime(),
+      };
+      const sessionObj = cache.session.getJSON("sessionObj");
+      if (
+        sessionObj === undefined ||
+        sessionObj === null ||
+        sessionObj === ""
+      ) {
+        cache.session.setJSON("sessionObj", requestObj);
       } else {
-        cache.session.setJSON('sessionObj', requestObj)
+        const s_url = sessionObj.url; // 请求地址
+        const s_data = sessionObj.data; // 请求数据
+        const s_time = sessionObj.time; // 请求时间
+        const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
+        if (
+          s_data === requestObj.data &&
+          requestObj.time - s_time < interval &&
+          s_url === requestObj.url
+        ) {
+          console.log(
+            s_data,
+            requestObj.data,
+            requestObj.time - s_time,
+            requestObj.url,
+            s_url
+          );
+          const message = "数据正在处理,请勿重复提交";
+          console.warn(`[${s_url}]: ` + message);
+          return Promise.reject(new Error(message));
+        } else {
+          cache.session.setJSON("sessionObj", requestObj);
+        }
       }
     }
+    return config;
+  },
+  (error: any) => {
+    Promise.reject(error);
   }
-  return config
-}, (error:any) => {
-    Promise.reject(error)
-})
+);
 
 // 响应拦截器
-service.interceptors.response.use((res:any) => {
+service.interceptors.response.use(
+  (res: any) => {
     // 未设置状态码则默认成功状态
     const code = res.data.code || 200;
     // 获取错误信息
-    let msg = errorCode[code] || res.data.msg || errorCode['default']
-    msg = msg && msg.length > 150 ? '数据异常' : msg;
+    let msg = errorCode[code] || res.data.msg || errorCode["default"];
+    msg = msg && msg.length > 150 ? "数据异常" : msg;
     // 二进制数据则直接返回
-    if(res.request.responseType ===  'blob' || res.request.responseType ===  'arraybuffer'){
-      return res.data
+    if (
+      res.request.responseType === "blob" ||
+      res.request.responseType === "arraybuffer"
+    ) {
+      return res.data;
     }
     if (code === 401) {
       if (!isRelogin.show) {
         isRelogin.show = true;
-        MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
-          confirmButtonText: '重新登录',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }
-      ).then(() => {
-        isRelogin.show = false;
-        store.dispatch('LogOut').then(() => {
-          // location.href = '/index';
-        })
-      }).catch(() => {
-        isRelogin.show = false;
-      });
-    }
-      return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
+        MessageBox.confirm(
+          "登录状态已过期,您可以继续留在该页面,或者重新登录",
+          "系统提示",
+          {
+            confirmButtonText: "重新登录",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            isRelogin.show = false;
+            store.dispatch("LogOut").then(() => {
+              // location.href = '/index';
+            });
+          })
+          .catch(() => {
+            isRelogin.show = false;
+          });
+      }
+      return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
     } else if (code === 500) {
       Message({
         message: msg,
-        type: 'error'
-      })
-      return Promise.reject(new Error(msg))
+        type: "error",
+      });
+      return Promise.reject(new Error(msg));
     } else if (code !== 200) {
       Notification.error({
-        title: '提示',
-        message: msg
-      })
-      return Promise.reject('error')
+        title: "提示",
+        message: msg,
+      });
+      return Promise.reject("error");
     } else {
-      return res.data
+      return res.data;
     }
   },
-  (error:any) => {
+  (error: any) => {
     // console.log('err' + error)
     let { message } = error;
     if (message == "Network Error") {
       message = "后端接口连接异常";
-    }
-    else if (message.includes("timeout")) {
+    } else if (message.includes("timeout")) {
       message = "系统接口请求超时";
-    }
-    else if (message.includes("Request failed with status code")) {
+    } else if (message.includes("Request failed with status code")) {
       message = "系统接口" + message.substr(message.length - 3) + "异常";
     }
     Message({
       message: message,
-      type: 'error',
-      duration: 5 * 1000
-    })
-    return Promise.reject(error)
+      type: "error",
+      duration: 5 * 1000,
+    });
+    return Promise.reject(error);
   }
-)
+);
 
 // 通用下载方法
-export function download(url:string, params:any, filename:any) {
-  downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
-  return service.post(url, params, {
-    transformRequest: [(params:any) => { return tansParams(params) }],
-    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
-    responseType: 'blob'
-  }).then(async (data:any) => {
-    const isLogin = await blobValidate(data);
-    if (isLogin) {
-      const blob = new Blob([data])
-      saveAs(blob, filename)
-    } else {
-      const resText = await data.text();
-      const rspObj = JSON.parse(resText);
-      const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
-      Message.error(errMsg);
-    }
-    downloadLoadingInstance.close();
-  }).catch((r:any) => {
-    console.error(r)
-    Message.error('下载文件出现错误,请联系管理员!')
-    downloadLoadingInstance.close();
-  })
+export function download(url: string, params: any, filename: any) {
+  downloadLoadingInstance = Loading.service({
+    text: "正在下载数据,请稍候",
+    spinner: "el-icon-loading",
+    background: "rgba(0, 0, 0, 0.7)",
+  });
+  return service
+    .post(url, params, {
+      transformRequest: [
+        (params: any) => {
+          return tansParams(params);
+        },
+      ],
+      headers: { "Content-Type": "application/x-www-form-urlencoded" },
+      responseType: "blob",
+    })
+    .then(async (data: any) => {
+      const isLogin = await blobValidate(data);
+      if (isLogin) {
+        const blob = new Blob([data]);
+        saveAs(blob, filename);
+      } else {
+        const resText = await data.text();
+        const rspObj = JSON.parse(resText);
+        const errMsg =
+          errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
+        Message.error(errMsg);
+      }
+      downloadLoadingInstance.close();
+    })
+    .catch((r: any) => {
+      console.error(r);
+      Message.error("下载文件出现错误,请联系管理员!");
+      downloadLoadingInstance.close();
+    });
 }
 
-export default service
+export default service;

+ 26 - 5
src/views/audit/store/components/liveView.vue

@@ -2,19 +2,31 @@
     <el-drawer v-loading="load" title="查看生命周期" :visible.sync="drawer" @close="close" :direction="direction" size="50%">
         <div class="content">
             <el-row :gutter="20">
-                <el-col :span="12">
+                <el-col :span="8">
                     名称:{{ liveData.material?.name }}
                 </el-col>
-                <el-col :span="12">
+                <el-col :span="8">
                     规格:{{ liveData.material?.materialSpec }}
                 </el-col>
 
-                <el-col :span="12">
-                    编号{{ liveData.materialSku?.skuCode }}
+                <el-col :span="8">
+                    编号{{ liveData.materialSku?.skuCode }}
                 </el-col>
-                <el-col :span="12">
+                <el-col :span="8">
                     分类:{{ liveData.materialCategory?.name }}
                 </el-col>
+                <el-col :span="8">
+                    仓库:
+                </el-col>
+                <el-col :span="8">
+                    仓位:
+                </el-col>
+                <el-col :span="8">
+                    供应商:
+                </el-col>
+                <el-col :span="8">
+                    供应商编号:
+                </el-col>
             </el-row>
             <p>OMS登记环节</p>
             <by-table :propConfig="tableConfig1" ref="table1" />
@@ -47,6 +59,9 @@ export default class LiveView extends Vue {
         columns: [{
             title: '事项',
             field: 'matter'
+        }, {
+            title: '来源',
+            field: 'source'
         }, {
             title: '操作人',
             field: 'operator'
@@ -66,6 +81,12 @@ export default class LiveView extends Vue {
             this.liveData = res.data;
             (this.$refs.table2 as any).setValue(this.liveData.warehousingList);
             (this.$refs.table3 as any).setValue(this.liveData.logisticsList);
+            (this.$refs.table1 as any).setValue([
+                { matter: '创建商品', source: 'OMS', operator: '管理员', time: '2025-07-06 10:01:22' },
+                { matter: '录入商品编号', source: 'OMS', operator: '管理员', time: '2025-07-06 10:05:43' },
+                { matter: '设置商品类别', source: 'OMS', operator: '管理员', time: '2025-07-06 10:10:32' },
+                { matter: '登记供应商', source: 'OMS', operator: '管理员', time: '2025-07-06 10:11:16' },
+            ]);
         } else {
             this.$message.error(res.msg)
         }

+ 1 - 2
src/views/oms/B2BOrder/components/autoAudit.vue

@@ -70,14 +70,13 @@ export default class AutoAudit extends Vue {
             if (data) {
                 let v = JSON.parse(data);
                 v.jobState = v.jobState == 1 ? true : false;
-                console.info(v);
                 (this.$refs.form as any).setValue(v);
             }
         }, 200);
     }
     btn() {
         let v = (this.$refs.form as any).getValue();
-        if (v.jobState === undefined) {
+        if (v.jobState === undefined || v.jobState === false) {
             v.jobState = 2
         } else {
             v.jobState = 1

+ 5 - 3
src/views/oms/B2BOrder/components/deliveryDetail.vue

@@ -230,7 +230,8 @@ export default class DeliveryDetail extends Vue {
               tmsGoodsTotalPrice: item.tmsGoodsTotalPrice,
               price: item.tmsGoodsPrice,
               weight: item.tmsWeight,
-              tmsQuantity: item.tmsQuantity
+              tmsQuantity: item.tmsQuantity,
+              remainAmount: 0
             })
           }
         }
@@ -269,7 +270,7 @@ export default class DeliveryDetail extends Vue {
           }
         }
         this.$nextTick(() => {
-          (this.$refs.info as any).setValue(this.value);
+          (this.$refs.info as any).setValue(this.value, false);
         })
       }
     }).catch(() => { })
@@ -471,4 +472,5 @@ export default class DeliveryDetail extends Vue {
   height: 60px;
   width: 100%;
   margin-top: 16px;
-}</style>
+}
+</style>

+ 5 - 2
src/views/oms/B2BOrder/components/deliveryGoodsInfo.vue

@@ -547,14 +547,17 @@ export default class DeliveryGoodsInfo extends Vue {
   }
 
 
-  setValue(v: any) {
+  setValue(v: any, isLoadInventory: boolean = true) {
+    console.info('setValue', v)
     this.value = v ? v : {};
     this.value.wmsSendType = 'B2BCK'
     this.totalWeight = 0;
     if (v.weight) {
       this.totalWeight = divide(v.weight, 1000)?.toFixed(3)
     }
-    this.getInventory();
+    if (isLoadInventory) {
+      this.getInventory();
+    }
 
     // this.totalWeight = divide(v.weight,1000);
     // if(this.value.subItem && this.value.subItem.length > 0){

+ 12 - 1
src/views/oms/B2BOrder/components/orderTable.vue

@@ -63,6 +63,13 @@
       </template>
     </vxe-column>
     <vxe-column field="orderTimeout" title="待处理时长" width="180">
+      <template #header="{ column }">
+        待处理时长
+        <el-tooltip class="item" effect="dark" :content="`监测订单创建后超时 [ ${orderTimeoutVal} ] 分钟未处理示为超时未处理,并提示超时标记。`"
+          placement="top">
+          <i class="el-icon-question"></i>
+        </el-tooltip>
+      </template>
       <template #default="{ row }">
         <span v-if="row.isOrderTimeout" style="color:red">
           <el-tag type="danger">已超时</el-tag>
@@ -153,7 +160,7 @@ export default class OrderTable extends Vue {
   @Prop()
   data!: Array<any>
   height = null
-
+  orderTimeoutVal = null;
   operationFlag: any = {
     'OMS': '手工下单',
     'COPY': '复制',
@@ -280,6 +287,10 @@ export default class OrderTable extends Vue {
   splitHandle(row: any) {
     this.$emit('splitHandle', row);
   }
+
+  setOrderTimeoutVal(v) {
+    this.orderTimeoutVal = v;
+  }
 }
 </script>
 

+ 38 - 7
src/views/oms/B2BOrder/index.vue

@@ -28,7 +28,7 @@
                   <div class="ques-list" v-show="showQues">
                     <template v-for="item of questData">
                       <el-checkbox :label="item.id" v-if="item.isShow == 1" :key="item.value">{{ item.type
-                        }}</el-checkbox>
+                      }}</el-checkbox>
                     </template>
                   </div>
                 </el-collapse-transition>
@@ -1352,6 +1352,9 @@ export default class Order extends Vue {
     queryOrderTimeConfig({ pageSize: 20, pageNum: 1 }).then(res => {
       if (res.code === 200) {
         this.orderTimeConfigOptions = res.rows
+        //将this.orderTimeConfigOptions[0].timeout的小时数值换成秒钟,如0.1小时=360秒
+        const tv = Number(this.orderTimeConfigOptions[0].timeout as number) * 60;
+        (this.$refs.orderTable as any).setOrderTimeoutVal(tv);
       }
     })
   }
@@ -1362,8 +1365,16 @@ export default class Order extends Vue {
     //遍历this.data
     for (let i = 0; i < this.data.length; i++) {
       if (!this.data[i].orderTimeout) continue;
+      const to = this.data[i].orderTimeout;
+      const cr = this.data[i].createTime;
+
+      //this.orderTimeConfigOptions[0].timeout的小时数值换成秒钟,如0.1小时=360秒
+      let timeout: number = Number(this.orderTimeConfigOptions[0].timeout as number);
+      let timeoutSec = timeout * 60 * 60;
+
       //orderTimeout属性YYYY-MM-DD HH:mm:ss和当前时间比较,返回相差多少小时多少分钟,如:超时2小时23分
       let time = this.data[i].orderTimeout.split(' ');
+      let createTime = this.data[i].createTime;
       let date = time[0];
       let time1 = time[1];
       let date1 = date.split('-');
@@ -1375,9 +1386,31 @@ export default class Order extends Vue {
       date2.setHours(parseInt(time2[0]));
       date2.setMinutes(parseInt(time2[1]));
       date2.setSeconds(parseInt(time2[2]));
-      let diff = date2.getTime() - new Date().getTime();
-      let diffHour = diff / 1000 / 60 / 60;
-      if (diffHour < 0) {
+      let diff = date2.getTime() - new Date(createTime).getTime();
+
+      //计算秒
+      let diffSec = Math.floor(Math.abs((diff / 1000)));
+      //计算分钟
+      let diffMin = Math.floor(Math.abs((diff / 1000 / 60)));
+      //计算小时
+      let diffHour = Math.floor(Math.abs((diff / 1000 / 60 / 60)));
+      if (Math.abs(diffSec) === 0) {
+        this.data[i].orderTimeout = "未超时";// + ',' + to + ',' + cr;
+        continue;
+      }
+      if (diff >= timeoutSec) {
+        this.data[i].isOrderTimeout = true;
+      }
+      console.info(diffSec, diffMin, diffHour, this.data[i].createTime, this.data[i].orderTimeout, timeoutSec, timeout);
+      if (diffSec < 60 && diffSec > 0) {
+        this.data[i].orderTimeout = "超时" + Math.abs(Math.round(diffSec)) + "秒";
+        continue;
+      }
+      if (diffMin < 60) {
+        this.data[i].orderTimeout = "超时" + Math.abs(Math.round(diffSec)) + "分";
+        continue;
+      }
+      if (diffHour > 0) {
         //diffHour保留两位小数
         let out = Math.abs(Math.round(diffHour * 100)) / 100;
         //计算分钟,取整
@@ -1386,9 +1419,7 @@ export default class Order extends Vue {
         out = Math.floor(out);
 
         this.data[i].orderTimeout = "超时" + out + "小时" + outMin + "分";
-        if (out >= this.orderTimeConfigOptions[0].timeout!) {
-          this.data[i].isOrderTimeout = true;
-        }
+        continue;
       }
     }
     this.$forceUpdate();

+ 1 - 56
src/views/oms/cackCallLog/index.vue

@@ -62,36 +62,6 @@ export default class BackCallLog extends Vue {
         field: 'respMsg',
         ellipsis: true,
         width: 200
-      }, {
-        title: '上游订单时间',
-        field: 'orderTime',
-        ellipsis: true,
-        width: 150
-      }, {
-        title: '接收时间',
-        field: 'getOrderTime',
-        ellipsis: true,
-        width: 150
-      }, {
-        title: '推送仓库时间',
-        field: 'pushWarehouseTime',
-        ellipsis: true,
-        width: 150
-      }, {
-        title: '仓库响应时间',
-        field: 'warehouseResponseTime',
-        ellipsis: true,
-        width: 150
-      }, {
-        title: '完成耗时(秒)',
-        field: 'finishTime',
-        ellipsis: true,
-        width: 150
-      }, {
-        title: '订单编号',
-        field: 'orderNo',
-        ellipsis: true,
-        width: 150
       }]
     }
   }
@@ -116,7 +86,7 @@ export default class BackCallLog extends Vue {
     this.load = true;
     dsCallbackLog(query).then((res: any) => {
       this.load = false;
-      (this.$refs.view as any).setTableValue(this.checkFinishTime(res.data.records as ICallbackLog[]));
+      (this.$refs.view as any).setTableValue(res.data.records);
       let page = {
         pageNo: res.data.current, //当前页
         pageSize: res.data.size, //每页条数
@@ -129,31 +99,6 @@ export default class BackCallLog extends Vue {
 
   }
 
-  //计算耗时
-  checkFinishTime(data: ICallbackLog[]): ICallbackLog[] {
-    //pushWarehouseTime-warehouseResponseTime
-    //小于1000毫秒显示单位为毫秒,大于1000毫秒小于60秒的显示秒,大于60秒的显示分钟
-    data.forEach((item: ICallbackLog) => {
-      if (!item.pushWarehouseTime || !item.warehouseResponseTime) {
-        item.finishTime = '-'
-        return
-      };
-
-      const start = new Date(item.pushWarehouseTime).getTime();
-      const end = new Date(item.warehouseResponseTime).getTime();
-      const diff = end - start;
-
-      if (diff < 1000) {
-        item.finishTime = `${diff}毫秒`;
-      } else if (diff < 60000) {
-        item.finishTime = `${Math.floor(diff / 1000)}秒`;
-      } else {
-        item.finishTime = `${Math.floor(diff / 60000)}分`;
-      }
-    })
-    return data
-  }
-
   mounted() {
     this.$nextTick(() => {
       this.getList()

+ 128 - 0
src/views/order/orderTimeLog/index.vue

@@ -0,0 +1,128 @@
+<template>
+    <div class="view" v-loading="load">
+        <module-view :propConfig="config" ref="view" @pagination="getList" @onRefresh="getList" />
+    </div>
+
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+import { dsCallbackLog, IResponeData, ICallbackLog, orderTimeList } from '@/api/omsOrder'
+@Component
+export default class BackCallLog extends Vue {
+    config: any = {
+        attr: {
+            calculateH: true
+        },
+        tool: {
+            tools: {
+                // search:true,
+                refresh: true
+            }
+        },
+        table: {
+            attr: {
+                size: 'mini',
+                seq: true,
+                align: 'center',
+                triggerRowCheck: 'row'
+            },
+            columns: [{
+                title: '上游订单时间',
+                field: 'orderTime',
+                ellipsis: true,
+            }, {
+                title: '接收时间',
+                field: 'getOrderTime',
+                ellipsis: true,
+            }, {
+                title: '推送仓库时间',
+                field: 'pushWarehouseTime',
+                ellipsis: true,
+            }, {
+                title: '仓库响应时间',
+                field: 'warehouseResponseTime',
+                ellipsis: true,
+            }, {
+                title: '完成耗时(秒)',
+                field: 'finishTime',
+                ellipsis: true,
+            }]
+        }
+    }
+    time: any;
+    timeNum = 0;
+    data: Array<any> = []
+    load = false;
+
+
+    getList() {
+        if (!this.$refs.view) {
+            if (this.timeNum > 5) {
+                return
+            }
+            this.timeNum++;
+            setTimeout(() => {
+                this.getList()
+            }, 500)
+            return
+        }
+        let query: any = (this.$refs.view as any).getQuery();
+        this.load = true;
+        orderTimeList(query).then((res: any) => {
+            this.load = false;
+            console.info(res.rows, 'sdsfs');
+            (this.$refs.view as any).setTableValue(this.checkFinishTime(res.rows as ICallbackLog[]));
+            //(this.$refs.view as any).setTableValue(res.rows);
+            let page = {
+                pageNo: 1,// res.data.current, //当前页
+                pageSize: 20,//res.data.size, //每页条数
+                total: res.total //总条数
+            };
+            (this.$refs.view as any).setPage(page)
+        }).catch(() => {
+            this.load = false;
+        });
+
+    }
+
+    //计算耗时
+    checkFinishTime(data: ICallbackLog[]): ICallbackLog[] {
+        //pushWarehouseTime-warehouseResponseTime
+        //小于1000毫秒显示单位为毫秒,大于1000毫秒小于60秒的显示秒,大于60秒的显示分钟
+        data.forEach((item: ICallbackLog) => {
+            if (!item.pushWarehouseTime || !item.warehouseResponseTime) {
+                item.finishTime = '-'
+                return
+            };
+
+            const start = new Date(item.pushWarehouseTime).getTime();
+            const end = new Date(item.warehouseResponseTime).getTime();
+            const diff = end - start;
+
+            if (diff < 1000) {
+                item.finishTime = `${diff}毫秒`;
+            } else if (diff < 60000) {
+                item.finishTime = `${Math.floor(diff / 1000)}秒`;
+            } else {
+                item.finishTime = `${Math.floor(diff / 60000)}分`;
+            }
+        })
+        return data
+    }
+
+    mounted() {
+        this.$nextTick(() => {
+            this.getList()
+        })
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.view {
+    width: 100%;
+    height: 100%;
+    overflow-y: hidden;
+}
+</style>