浏览代码

更新首页统计数据

zhaoyaxiong 1 年之前
父节点
当前提交
ac4727ab43
共有 2 个文件被更改,包括 128 次插入13 次删除
  1. 28 0
      ZRAdmin-vue-main/src/api/business/index.js
  2. 100 13
      ZRAdmin-vue-main/src/views/index_v1.vue

+ 28 - 0
ZRAdmin-vue-main/src/api/business/index.js

@@ -7,6 +7,13 @@ export function GetQaCount(query) {
     params: query,
   })
 }
+export function YGetQaCount(query) {
+  return request({
+    url: 'business/QaInspectRecord/YesterdayDailyStatistics',
+    method: 'get',
+    params: query,
+  })
+}
 //获取日入库数,区分关键件非关键件
 export function GetInCount(query) {
   return request({
@@ -15,6 +22,13 @@ export function GetInCount(query) {
     params: query,
   })
 }
+export function YGetInCount(query) {
+  return request({
+    url: 'business/InInstoreRecord/YesterdayDailyStatistics',
+    method: 'get',
+    params: query,
+  })
+}
 //获取日出库数,区分关键件非关键件
 export function GetOutCount(query) {
   return request({
@@ -23,6 +37,13 @@ export function GetOutCount(query) {
     params: query,
   })
 }
+export function YGetOutCount(query) {
+  return request({
+    url: 'business/OutOutstoreRecord/YesterdayDailyStatistics',
+    method: 'get',
+    params: query,
+  })
+}
 //获取日装配数,区分关键件非关键件
 export function GetAssCount(query) {
   return request({
@@ -31,6 +52,13 @@ export function GetAssCount(query) {
     params: query,
   })
 }
+export function YGetAssCount(query) {
+  return request({
+    url: 'business/OutAssembleRecord/YesterdayDailyStatistics',
+    method: 'get',
+    params: query,
+  })
+}
 //获取关键件非关键件数量
 export function GetKeyProportion(query) {
   return request({

+ 100 - 13
ZRAdmin-vue-main/src/views/index_v1.vue

@@ -34,10 +34,14 @@
                   <el-statistic :value="DailyStatistics.qa_key">
                     <template #suffix>
                       <span class="than-yesterday-label">相比昨天</span>
-                      <span class="than-yesterday green">
-                        24%<el-icon>
+                      <span class="than-yesterday" :class="ThanYesterday.qa < 1 ? 'green' : 'red'">
+                        {{ ThanYesterday.qa > 100 ? ThanYesterday.qa - 100 : ThanYesterday.qa }}%
+                        <el-icon v-if="ThanYesterday.qa < 100">
                           <CaretBottom />
                         </el-icon>
+                        <el-icon v-if="ThanYesterday.qa > 100">
+                          <CaretTop />
+                        </el-icon>
                       </span>
                     </template>
                   </el-statistic>
@@ -53,8 +57,12 @@
                   <el-statistic :value="DailyStatistics.in_key">
                     <template #suffix>
                       <span class="than-yesterday-label">相比昨天</span>
-                      <span class="than-yesterday red">
-                        24%<el-icon>
+                      <span class="than-yesterday" :class="ThanYesterday.qa < 1 ? 'green' : 'red'">
+                        {{ ThanYesterday.in > 100 ? ThanYesterday.in - 100 : ThanYesterday.in }}%
+                        <el-icon v-if="ThanYesterday.in < 100">
+                          <CaretBottom />
+                        </el-icon>
+                        <el-icon v-if="ThanYesterday.in > 100">
                           <CaretTop />
                         </el-icon>
                       </span>
@@ -72,8 +80,12 @@
                   <el-statistic :value="DailyStatistics.out_key">
                     <template #suffix>
                       <span class="than-yesterday-label">相比昨天</span>
-                      <span class="than-yesterday red">
-                        24%<el-icon>
+                      <span class="than-yesterday " :class="ThanYesterday.qa < 1 ? 'green' : 'red'">
+                        {{ ThanYesterday.out > 100 ? ThanYesterday.out - 100 : ThanYesterday.out }}%
+                        <el-icon v-if="ThanYesterday.out < 100">
+                          <CaretBottom />
+                        </el-icon>
+                        <el-icon v-if="ThanYesterday.out > 100">
                           <CaretTop />
                         </el-icon>
                       </span>
@@ -91,8 +103,12 @@
                   <el-statistic :value="DailyStatistics.ass_key">
                     <template #suffix>
                       <span class="than-yesterday-label">相比昨天</span>
-                      <span class="than-yesterday red">
-                        24%<el-icon>
+                      <span class="than-yesterday " :class="ThanYesterday.qa < 1 ? 'green' : 'red'">
+                        {{ ThanYesterday.ass > 100 ? ThanYesterday.ass - 100 : ThanYesterday.ass }}%
+                        <el-icon v-if="ThanYesterday.ass < 100">
+                          <CaretBottom />
+                        </el-icon>
+                        <el-icon v-if="ThanYesterday.ass > 100">
                           <CaretTop />
                         </el-icon>
                       </span>
@@ -110,8 +126,12 @@
                   <el-statistic :value="totalUnkey">
                     <template #suffix>
                       <span class="than-yesterday-label">相比昨天</span>
-                      <span class="than-yesterday red">
-                        24%<el-icon>
+                      <span class="than-yesterday " :class="ThanYesterday.qa < 1 ? 'green' : 'red'">
+                        {{ ThanYesterday.totalUnkey > 100 ? ThanYesterday.totalUnkey - 100 : ThanYesterday.totalUnkey }}%
+                        <el-icon v-if="ThanYesterday.totalUnkey < 100">
+                          <CaretBottom />
+                        </el-icon>
+                        <el-icon v-if="ThanYesterday.totalUnkey > 100">
                           <CaretTop />
                         </el-icon>
                       </span>
@@ -201,7 +221,13 @@ import logoL from '@/assets/logo/logo-L.png'
 
 import { list as listOperLog } from '@/api/monitor/operlog'
 
-import { GetQaCount, GetInCount, GetOutCount, GetAssCount, GetKeyProportion, GetCategoryProportion } from '@/api/business/index.js'
+import {
+  GetQaCount, YGetQaCount,
+  GetInCount, YGetInCount,
+  GetOutCount, YGetOutCount,
+  GetAssCount, YGetAssCount,
+  GetKeyProportion, GetCategoryProportion
+} from '@/api/business/index.js'
 
 const strStatQA = '关键件质检数统计:'
 const strStatInstore = '关键件入库数统计:'
@@ -310,8 +336,17 @@ const YesterdayStatistics = reactive({
   ass: 0,
   ass_key: 0,
 })
+const ThanYesterday = reactive({
+  qa: computed(() => { return DailyStatistics.qa / YesterdayStatistics.qa * 100 }),
+  in: computed(() => { return DailyStatistics.in / YesterdayStatistics.in * 100 }),
+  out: computed(() => { return DailyStatistics.out / YesterdayStatistics.out * 100 }),
+  ass: computed(() => { return DailyStatistics.ass / YesterdayStatistics.ass * 100 }),
+  totalUnkey: computed(() => { return totalUnkey / yesterdayTotalUnkey * 100 }),
+})
 // 非关键件一共作业数
-var totalUnkey = computed(() => { return DailyStatistics.qa + DailyStatistics.in + DailyStatistics.out + DailyStatistics.ass })
+const totalUnkey = computed(() => { return DailyStatistics.qa + DailyStatistics.in + DailyStatistics.out + DailyStatistics.ass })
+const yesterdayTotalUnkey = computed(() => { return YesterdayStatistics.qa + YesterdayStatistics.in + YesterdayStatistics.out + YesterdayStatistics.ass })
+
 //关键件占比
 const groupByKey = reactive({
   unkey: 0,
@@ -406,6 +441,58 @@ function getStatistics() {
       }
     }
   })
+  YGetQaCount().then((response) => {
+    if (response.code == 200) {
+      // console.log(response.data)
+      for (var i = 0; i < response.data.length; i++) {
+        if (response.data[i].keyFlag) {
+          YesterdayStatistics.qa_key = response.data[i]["sumQty"]
+        }
+        else {
+          YesterdayStatistics.qa = response.data[i]["sumQty"]
+        }
+      }
+    }
+  })
+  YGetInCount().then((response) => {
+    if (response.code == 200) {
+      // console.log(response.data)
+      for (var i = 0; i < response.data.length; i++) {
+        if (response.data[i].keyFlag) {
+          YesterdayStatistics.in_key = response.data[i]["sumQty"]
+        }
+        else {
+          YesterdayStatistics.in = response.data[i]["sumQty"]
+        }
+      }
+    }
+  })
+  YGetOutCount().then((response) => {
+    if (response.code == 200) {
+      // console.log(response.data)
+      for (var i = 0; i < response.data.length; i++) {
+        if (response.data[i].keyFlag) {
+          YesterdayStatistics.out_key = response.data[i]["sumQty"]
+        }
+        else {
+          YesterdayStatistics.out = response.data[i]["sumQty"]
+        }
+      }
+    }
+  })
+  YGetAssCount().then((response) => {
+    if (response.code == 200) {
+      // console.log(response.data)
+      for (var i = 0; i < response.data.length; i++) {
+        if (response.data[i].keyFlag) {
+          YesterdayStatistics.ass_key = response.data[i]["sumQty"]
+        }
+        else {
+          YesterdayStatistics.ass = response.data[i]["sumQty"]
+        }
+      }
+    }
+  })
   GetKeyProportion().then((response) => {
     if (response.code == 200) {
       // console.log(response.data)
@@ -421,7 +508,7 @@ function getStatistics() {
   })
   GetCategoryProportion().then((response) => {
     if (response.code == 200) {
-      console.log(response.data)
+      // console.log(response.data)
       for (var i = 0; i < response.data.length; i++) {
         if (response.data[i].category == "外协件") {
           groupByCategory.category0 = response.data[i]["sumQty"]